2
我想弄清楚如何包装点击事件。例如,这是我想要的代码。将现有的jquery事件与默认设置相结合
$("#test").aclick(function() {
alert('hi');
});
aclick做的唯一事情就是自动使用e.preventDefault。 这是什么东西?
$.fn.aclick = function(e) {
e.preventDefault();
return $.fn.click.apply(this, arguments);
});
谢谢。
我想我只是去了进深结......明白这段代码是要带我一个月。谨慎提供解释,我的JavaScript/jQuery是生锈的... – erroric 2014-07-04 18:09:08
这是一个开始:http://stackoverflow.com/questions/4083351/what-does-jquery-fn-mean – erroric 2014-07-04 18:14:09