As in jQuery 1.7, the on docs function is used to replace existing individual event binding methods:
one docs is a special case and you must continue to use it as is.
Existing events continue to exist and are simply aliases on . There is no official report that they will be deleted, so you can be safe to continue to use them if you understand them better. live and die are deprecated from jQuery 1.7, as mentioned in the blog post and on live docs .
The on event has several formats, but the signature of the function is as follows:
.on( events [, selector] [, data], handler )
Bind:
$(selector).bind(events, data, handler); $(selector).on(events, null, data, handler);
Source:
bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }
Delegate:
$(selector).delegate(subselector, events, data, handler); $(selector).on(events, subselector, data, handler);
Source:
delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }
Live:
$(selector).live(events, data, handler); $(document).on(events, selector, data, handler);
Source:
live: function( types, data, fn ) { jQuery( this.context ).on( types, this.selector, data, fn ); return this; }
Note that this.context was set using this.context = document; as indicated in $(document).on(...) .