Answer the question
In order to leave comments, you need to log in
How to properly attach an event to the created element?
created/added element div class="activity /div
how to attach Event ?
elem.addEventLis... to it every time it is created? what
if I just added it via innerHTML += div class="activity" ?
Answer the question
In order to leave comments, you need to log in
1. If using jquery:
For dynamically created elements. Where click is an event, selector is a selector, handler is a function.
2. If without jquery:
you can do this , but this option is not very good. It will be better through addEventListener.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question