jQuery documentation for .on()
.click()
is a shortcut for .on('click', handler)
. There is no difference at all. So you might as well stick to .on()
and save that extra function call.
jQuery documentation for .bind()
As of jQuery 1.7, the .bind()
, .live()
and .delegate()
methods have been superseded by .on()
. These functions are going to be removed in future versions of jQuery. The .on()
method is the preferred method for attaching event handlers to a document.
Internally, jQuery maps all these methods and shorthand event handler setters to the .on()
method, further indicating that you should ignore these methods from now on and just use .on()
:
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
}