What to research for new elements with event listeners?
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
What to research for new elements with event listeners?
What should I research online to figure out how to get event listeners to recognize when new elements created by JavaScript (not via AJAX but just by a function) exist? The event listeners are loaded on my site onload, a user takes an action 40 seconds after the page loads that creates a new element via createElement, they click on the element however the event listeners don't see the newly created elements. Suggestions please?
Re: What to research for new elements with event listeners?
Put the code that adds the event listeners in a function x(). Call that function when a new element is created - not by listening, but by calling the x() when the code to create the new element is executed.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.