4 ms·
The most important deprecations are of live/die, though they won't be removed until 1.9. Use delegate as the replacement $("#foo").live("click", function()
by johnbender 15y ago
The most important deprecations are of live/die, though they won't be removed until 1.9. Use delegate as the replacement
$("#foo").live("click", function(){ });
is equivalent to
$(document).delegate( "#foo", "click", function() { });
- masklinn 15y ago> Use delegate as the replacement Actually, use the new `#on` as replacement: it can handle the job of `#bind` and `#delegate` (and `#live` of course), so I'd fully expect it to be the only one remaining in the fullness of time. Warning: the first two arguments are reversed compared to `#delegate`: $(document).delegate("#foo", "click", function() { }); becomes $(document).on("click", "#foo", function() { });
- funksta 15y agoThere's a nice article about transitioning to .on() and .off(), including the changes and benefits, at: http://www.andismith.com/blog/2011/11/on-and-off/ http://www.andismith.com/blog/2011/11/on-and-off/