[英]Remove specific jQuery click event from element
I understand event can be removed from an element by using .unbind() or .off(). 我理解可以使用.unbind()或.off()从元素中删除事件。 However I am wondering if is that possible to remove specific click event and leave others attached.
但是,我想知道是否可以删除特定的点击事件并留下其他人。 For example assuming I have a element with two events attached as follow:
例如,假设我有一个附加了两个事件的元素,如下所示:
$("#MyDiv").click(function() {
alert("I am first Event");
});
$("#MyDiv").click(function () {
alert("I am second Event");
});
Is that possible to remove First event and leave second one attached, using some sort of key? 是否有可能删除第一个事件并使用某种键来附加第二个事件?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.