gpt4 book ai didi

javascript - 如何在jquery中使.unclick = unbind ('click'?

转载 作者:行者123 更新时间:2023-11-28 12:11:18 30 4
gpt4 key购买 nike

我想要 unbind('click' 的快捷符号。我想要 .unclick 被 unbind('click'.

最佳答案

我想你想要这样的东西:

$.fn['unclick'] = function(){
return this.unbind('click');
};

现在以下两行是等效的:

$(...).unbind('click');
$(...).unclick();
<小时/>

对于所有事件(从 jQuery source 复制的事件列表):

var events = ('blur,focus,load,resize,scroll,unload,click,dblclick,' +
'mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,' +
'mouseleave,change,select,submit,keydown,keypress,keyup,error'
).split(',');

jQuery.each(events, function(i, name){
jQuery.fn['un' + name] = function(){
return this.unbind(name);
};
});

关于javascript - 如何在jquery中使.unclick = unbind ('click'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1040249/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com