javascript - jQuery live alternative (is there only on()?) -
i using live() using function @ ajax datas.
just like: $(".mydiv").live('click', function(){ alert("blablabla"); })
it working fine, if click on ajax datas '.mydiv'
but 'on' method doesn't support this?
$(".removebet").on('click',' i', function(){alert("blablabla");});
it doesn't work, if "i" come ajax datas. why? how can solve this?
the selector elements want bind using .on
needs exist when .on
called. if .removebet
not exist when .on
called (it sounds doesn't), .on
won't bind anything.
your safest bet use
$(document).on("click", ".removebet i" ...
ideally pick existing selector closer target descendants document
.
Comments
Post a Comment