luke-chang / js-spatial-navigation

A javascript-based implementation of Spatial Navigation.
Mozilla Public License 2.0
370 stars 117 forks source link

can navigate but not click on dynamic dom eliments #49

Closed Rob2k9 closed 2 years ago

Rob2k9 commented 2 years ago

@luke-chang i am having a small issue when using this code i am pulling new eliments into dom using a json request and then making them focusable using SN.makeFocusable();

my issue is that when i click the enter key on the newly populated eliments it does not run the code to grab the id and run the appropriate code i have double checked this by doing the following

setting a default eliment clicking on it and javascript alert shows and then inner html is cleared and then the same default eliment is reappended and SN.makeFocusable(); is run again i can then navigate back to this default eliment but click on it does not run the function to show the alert even tho it worked when loaded with the page initially so any eliments loaded to dom after the initial page load and able to be navigated but cant be clicked

luke-chang commented 2 years ago

I'm curious how you bind the event handler to the newly added element. Could you provide some code snippet?

Rob2k9 commented 2 years ago

I'm curious how you bind the event handler to the newly added element. Could you provide some code snippet?

i am using the default code from example 3.1 i have just added new eliments with an id that runs a function the same as the settings modal and this then replaces the inner html of middle eliment with new eliments with specific ids but when i click on these elimtnes it dosent go through the ids and run the functions

` Githubissues.

  • Githubissues is a development platform for aggregating issues.