javascript - Button click event on $.post-loaded button -


after filling div $(mydiv).load() call, want catch click event on button inside div.

now reason $('.mybutton').click not invoked when click on button loaded through jquery's load function.

what best way around this?

you have catch event of dynamic object, have use .on() try this:

$(document).on('click', '.mybutton', function(){   //your code }); 

instead of

$('.mybutton').click(function(){   //your code }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -