Differences between. band (). live (). delegate (). on () in jquery, jquery. band
Bind (type, [data], fn) binds an event handler function to a specific event of each matching element.
$ ("A"). bind ("click", function () {alert ("OK ");});
Live (type, [data], fn) attaches an event handler function to all matching elements, even if the element is added later
$ ("A"). live ("click", function () {alert ("OK ");});
Delegate (selector, [type], [data], fn) adds one or more event handlers to the specified Element (child element of the selected element, and specify the function to run when these events occur
$ ("# Container"). delegate ("a", "click", function () {alert ("OK ");})
On (events, [selector], [data], fn) binds one or more event handlers to the selected element.
Differences:
@ 1. bind () is directly bound to the element
@ 2. live () is bound to an element by means of bubbling. More suitable for the list type, bind to the document DOM node. And. bind () support dynamic data.
@ 3. delegate () is a more precise event proxy in a small scope, with better performance than. live ()
@ 4. on () is the latest version 1.9 integrated with the previous three methods of new event Binding Mechanism