I have a dynamically generated list, and then I click on an element and pass index() another function.
The problem is that this list populates dynamically and my code does not respond when I make a click event. BUT, if I add some Static li elements to the list in addition to dynamically populated those that work Static. It is very strange.
Some codes:
This dynamically creates a list:
function SetOpenRecentURL( openRecentURL ) { $('#recentProjectsId').append('<li>' + openRecentURL + '</li>') }
This is a click event to pass Index ():
$('#recentProjectsId li').on('click', function () { var projIndex = $(this).index(); console.log(projIndex) OpenProject() })
HTML with multiple static faces
<div class="recentProjects" id="recentProjectsId"> <li>Test 1</li> <li>Test 2</li> </div>
When I run my program, my list looks perfect and includes whether my static plus my dynamic ones, but I canβt click on dynamic ones, only static ones.
source share