Is there a way to watch a document and bind an event when a node classed “media-modal” is dynamically added?
Incidentally, I don’t have access to the code that triggers the node creation.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I take back my comment, you can watch the
DOMNodeInsertedmutation event and run a reference against the class name of the element added.You could actually save a bit of performance by binding to the closest static parent element.
You can see a working jsFiddle here