Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jQuery onclick not firing on dynamically inserted HTML elements

$(document).on( 'click', '.classname', function () { 
alert('clicked');
});

**** Another Method ****
// where #wrapper is a static element in which you add the dynamic links.
$( '#wrapper' ).on( 'click', 'a', function () { alert('clicked'); });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jQuery #onclick #firing #dynamically #inserted #HTML #elements
ADD COMMENT
Topic
Name
1+7 =