jQuery:在方法上取消jQuery 2.0的绑定 [英] jQuery: Unbind jQuery 2.0 on method
本文介绍了jQuery:在方法上取消jQuery 2.0的绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在jQuery 1.9中已弃用live()
,因此新方法变为:
In jQuery 1.9 live()
was deprecated, so the new method became:
$(document).on("mouseover","*",blahblahfunc);
我无法解除绑定"blahblahfunc". 通过
I'm unable to unbind "blahblahfunc". via
$("*").unbind("mouseover mouseout click");
注意到我将函数绑定到dom中的每个元素,有什么想法吗?
Notice that I'm binding a function to every element in the dom, any ideas?
推荐答案
使用.off()
请参阅Api文档
off()方法删除与.on()关联的事件处理程序.
The off() method removes event handlers that were attached with .on()
$(document).on("mouseover","*",blahblahfunc);
$(document).off("mouseover","*",blahblahfunc);
这篇关于jQuery:在方法上取消jQuery 2.0的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文