Bind (TYPE,[DATA],FN) binds event handlers for specific events of each matching element
$ ("a"). Bind ("click", Function () {alert ("OK");});
With $ ("a"). Click (function () {...}); Different usages, but bind can bind multiple events and can also be unbound
$ (selector). Bind ({event:functionevent:function, ...});
Live (TYPE,[DATA],FN) attaches an event handler function to all matching elements, even if the element is added later in the
The event handlers attached through the live () method apply to the current and future elements of the matching selector (such as new elements created by the script).
Multiple bindings cannot be used before 1.4.0 (not including 1.4.0), and a single example is: $ ("a"). Live ("Click", Function () {alert ("OK");});
In 1.4.0-1.4. 2 began to support, the example is as follows: $ ('. Hoverme '). Live (' mouseover mouseout ', function ( event) {if (Event.type = = ' MouseOver ') {// do something on mouseover Else { // do something on mouseout }});
Theversion after 1.4.3 has started to support another method of updating:
$ (selector). Live ({event:functionevent:function
Delegate (SELECTOR,[TYPE],[DATA],FN) The specified element (which belongs to the child element of the selected element) adds one or more event handlers and specifies the function to run when these events occur
Event handlers that use the delegate () method apply to current or future elements, such as new elements created by a script.
$ ("#container"). Delegate ("A", "click", Function () {alert ("OK");})
On (EVENTS,[SELECTOR],[DATA],FN) an event handler that is bound to one or more events on the selection element
$ (selector). On ({event:function, event:function, ...})
Difference:
. Bind () is directly bound on the element
. Live () is bound to an element by bubbling way. More appropriate for the list type, bound to the document DOM node. and. Bind () have the advantage of supporting dynamic data.
. Delegate () is a more precise, small-scale use of event proxies with better performance. Live ()
. On () is the latest 1.9 version of the new event binding mechanism that incorporates the previous three ways
The difference between the. bind (). Live (). Delegate () on () in jquery.