Reputation: 4826
The .die()
method has been removed from jQuery 1.9. Any idea of how to achieve the same thing? I'm trying to kill a click handlers on page load on some links.
Thanks
Upvotes: 1
Views: 9886
Reputation: 7299
The jQuery Core 1.9 Upgrade Guide is a fantastic resource with instructions for how to handle deprecated/removed functions and other breaking changes in 1.9.
Quote from there:
The .die() method has been deprecated since jQuery 1.7 and has been removed in 1.9. We recommend upgrading code to use the .off() method instead. To exactly match $("a.foo").die("click"), for example, you can write $(document).off("click", "a.foo"). For more information, see the .off() documentation. In the meantime, the jQuery Migrate plugin can be used to restore the .die() functionality.
Note that while you should replace die()
with off()
, you can also use the Migrate plugin if you need a quick fix that will make your existing die()
calls work with the 1.9 core.
Upvotes: 2
Reputation: 207923
As of jQuery 1.7, use of .die()
(and its complementary method, .live()
) is not recommended. Instead, use .off()
to remove event handlers bound with .on()
.
Upvotes: 1
Reputation: 66693
Use off()
- Documentation for off()
: http://api.jquery.com/off/
Upvotes: 6