I want to create <li> in existing <ul>. I succed to make that. But I want to make onclick() function on <li> who was created. But nothing happens when I want to call my JavaScript method.
I think <li> doesn't exist when I load my browser page and when <li> are create the browser doesn't find <li> who was created.
Method JavaScript to create <li> in <ul> :
$('#myList').click(function () {
$("#firstYear ul").append('<li><a href="">' + valueArray + '</a></li>');
});
Method OnClick on <li> who was create but nothing happens :
$('#firstYear ul li').click(function () {
console.log('Ok');
});
If you have some solutions :)
Thank's