Reputation: 6786
According to the jQuery API Description: live is completely removed in latest version. But its been used in our projects extensively. For example:
$('div.collapsed').live('mouseover', function () {
TBD.GENERAL.showLoginOther(this);
});
$(".info_bar .filter a, .pagination a").live("click", function () {
TBD.DHTML.shadeWithLoading($(this).data('container-id'));
$.getScript(this.href);
return false;
});
$("form[loading-effect]").live('ajax:before', function () {
$(this).find('.button_panels, .loading_panels').toggle();
});
.........
etc.
Now if I want to use the latest jquery what will be the correct replacement of live? delegate or on ?
Anticipating a bit explanation. Thanks in advance
Upvotes: 1
Views: 70
Reputation: 28763
Since .live()
is deprecated you better to use .on()
like
$('div.collapsed').on('mouseover', function () {
or can use like
$(document).on('mouseover','div.collapsed', function () {
Because
and the .on() method provides all functionality required for attaching event handlers.
Upvotes: 1