Possible Duplicate:
jQuery: how to replace .live with .on?
.live() was deprecated in jQuery 1.7 and removed in version 1.9. I just upgraded jQuery to 1.9.0 in our application and I saw that we used tons of .live()
calls in the past.
I ported all the .live()
calls to .on() calls. In most cases it's a straightforward update (simple cases like the one in the second snippet on the .live() page). But at several places I have something like:
(function($){
$(document).ready(function() {
$('.ui-jqgrid-btable').find('a.pop_dialog_jqgrid').live('click', function() {
//some code here
});
});
})(jQuery);
which I have ported to:
(function($){
$(document).ready(function() {
$(document).on('click', $('.ui-jqgrid-btable').find('a.pop_dialog_jqgrid'), function() {
//some code here
});
});
})(jQuery);
But it's not doing the same thing at all with the new code (all the clicks anywhere on the page fire the "some code").
Anyone can enlighten me please?