3 ms·
> 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
by 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/