So I have a jquery function that does something when class ‘ajaxsubnote’ is clicked
$('.ajaxsubnote').click(function(){
//do something....
})
But the user can add elements with class ‘ajaxsubnote’ dynamically via jquery. My problem is these dynamically added elements, when clicked, don’t seem to call the above function, whereas the ones originally on the DOM do…
Any way around this?
You should use delegated event method to handle dynamic elements. See below,
For older versions use delegate,