Monday, 9 September 2013

why does click without body not work

why does click without body not work

I have multiple myclass class on the page and I append some more of those
using ajax
if I do this
$('.myclass').click(function(){
alert(1);
});
it works for all non-ajax appended requests but not for the classes that
get appended by ajax. for those this works
$(body).on('click','myclass',function(){
alert(1);
});
my question, why is that??

No comments:

Post a Comment