I have the following code:
jQuery(function($){
$( '.comment-form' ).submit(function(){
// do stuff
});
});
I want to target this element when it has been added dynamically. So I use:
jQuery(function($){
$(document).on('submit', '.comment-form',function(){
// do stuff
});
});
But the event trigger is never added when the element is created dynamically. Is there an issue with the following:
$(document).on('submit', '.comment-form',function(){
As far as I can see, this is correct.