如何使用jquery解除绑定所有事件 [英] how to unbind all event using jquery

查看:30
本文介绍了如何使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆