如何使用jquery解除所有事件的绑定 [英] how to unbind all event using jquery
本文介绍了如何使用jquery解除所有事件的绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用此代码来删除点击事件,
i can use this code to remove click event,
$('p').unbind('click')
但是,有一些方法可以删除所有事件吗?
but , has some method to remove all event ?
在jquery中有一个名为 unbindAll
的方法?
has a method named unbindAll
in jquery ?
谢谢
推荐答案
您可以致电 。 unbind()
,无参数:
You can call .unbind()
without parameters to do this:
$('p').unbind();
从文档:
在最简单的情况下,没有参数,
.unbind ()
删除附加到元素的所有处理程序。
In the simplest case, with no arguments,
.unbind()
removes all handlers attached to the elements.
这篇关于如何使用jquery解除所有事件的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文