When using jQuery to hookup an event handler, is there any difference between using the click method
$().click(fn)
versus using the bind method
$().bind('click',fn);
Other than bind's optional data parameter.
For what it's worth, from the jQuery source:
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
"change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
// Handle event binding
jQuery.fn[name] = function(fn){
return fn ? this.bind(name, fn) : this.trigger(name);
};
});
So no, there's no difference -
$().click(fn)
calls
$().bind('click',fn)