Call Custom Function On Dynamically Created Elements With Jquery
I have an external function which has to be called for all elements with a certain class, like this: jQuery('.myClass').myFunction(); This works, but how can I make this happen fo
Solution 1:
<div class="root">
<span class="line"></span>
</div>
jQuery(document).on('DOMNodeInserted','.line',function(){
jQuery(this).myFunction();
console.log("object added");})
jQuery(".root").append(jQuery("<span/>").addClass("line"))
for details and Mutation events list this link
Post a Comment for "Call Custom Function On Dynamically Created Elements With Jquery"