我想要 unbind('click'. 我想要 .unclick 是 unbind('click'.
我想你想要这样的东西:
$.fn['unclick'] = function(){
return this.unbind('click');
};
Run Code Online (Sandbox Code Playgroud)
现在以下两行是等效的:
$(...).unbind('click');
$(...).unclick();
Run Code Online (Sandbox Code Playgroud)
对于所有事件(从jQuery 源复制的事件列表):
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);
};
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3241 次 |
| 最近记录: |