[jQuery] Re: .click vs. .bind
Thank you guys for your help! On Nov 23, 8:01 pm, George [EMAIL PROTECTED] wrote: Just a note: The bind notation allows you to specify additional data for your even handler function. I am actually used to always use a .bind George. On Nov 23, 7:47 pm, Michael Geary [EMAIL PROTECTED] wrote: There is no difference at all. $(...).click( fn ) is merely a shorthand for: $(...).bind( 'click', fn ); You can see this in the code that creates .click() and the other shortcut methods: jQuery.each( (blur,focus,load,resize,scroll,unload,click,dblclick, + mousedown,mouseup,mousemove,mouseover,mouseout,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); }; }); -Mike From: coughlinsmyalias What is the main difference between using .bind() and .click(), when I was reading up, it was mentioning it removes event bubbling?- Hide quoted text - - Show quoted text -
[jQuery] Re: .click vs. .bind
There is no difference at all. $(...).click( fn ) is merely a shorthand for: $(...).bind( 'click', fn ); You can see this in the code that creates .click() and the other shortcut methods: jQuery.each( (blur,focus,load,resize,scroll,unload,click,dblclick, + mousedown,mouseup,mousemove,mouseover,mouseout,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); }; }); -Mike From: coughlinsmyalias What is the main difference between using .bind() and .click(), when I was reading up, it was mentioning it removes event bubbling?
[jQuery] Re: .click vs. .bind
Just a note: The bind notation allows you to specify additional data for your even handler function. I am actually used to always use a .bind George. On Nov 23, 7:47 pm, Michael Geary [EMAIL PROTECTED] wrote: There is no difference at all. $(...).click( fn ) is merely a shorthand for: $(...).bind( 'click', fn ); You can see this in the code that creates .click() and the other shortcut methods: jQuery.each( (blur,focus,load,resize,scroll,unload,click,dblclick, + mousedown,mouseup,mousemove,mouseover,mouseout,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); }; }); -Mike From: coughlinsmyalias What is the main difference between using .bind() and .click(), when I was reading up, it was mentioning it removes event bubbling?- Hide quoted text - - Show quoted text -