TheFilmGod Posted July 7, 2009 Share Posted July 7, 2009 I have dynamically created content using javascript. However, it seems like I can't get of the dynamically generated content to fire events when clicked. The only thing i could find on google about this "event does not fire unless appended to DOM..." anyone care to help me? Link to comment https://forums.phpfreaks.com/topic/165007-solved-event-does-not-fire-on-dynamic-content/ Share on other sites More sharing options...
TheFilmGod Posted July 7, 2009 Author Share Posted July 7, 2009 I finally figured out after like 2 hours of grueling agony. I remapped all the events onto the events immediately after the innerhtml. The reason is simple - the elements did not exist before innerhtml so the program needs to remap the new events onto the elements after they are created. Google has let this miracle happen. 2+ hours of searching got me to finally find the answer. Link to comment https://forums.phpfreaks.com/topic/165007-solved-event-does-not-fire-on-dynamic-content/#findComment-870111 Share on other sites More sharing options...
haku Posted July 7, 2009 Share Posted July 7, 2009 That's a pretty common error. You have to attach handlers to newly created elements. Link to comment https://forums.phpfreaks.com/topic/165007-solved-event-does-not-fire-on-dynamic-content/#findComment-870141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.