Currently support click, DblClick, MouseDown, MouseUp, MouseMove, MouseOver, Mouseout, KeyDown, KeyPress, KeyUp.
Also does not support blur, Focus, MouseEnter, MouseLeave, change, submit
Unlike bind (), Live () can only bind one event at a time.
This approach is similar to traditional bind, except that using live to bind events gives all current and future elements of the page a binding event (using delegated methods). For example, if you bind the click event to all the Li on the page with live. So when you add an Li to this page later, the Click event for this newly added Li is still available. Without having to give this newly added element binding event.
Live () is similar to popular livequery Plug-ins, but there are several main differences:
*. Live currently supports only a subset of all events, supported by a list reference above.
*. Live does not support livequery-provided "no event" style callback functions. Live can only bind event handler functions.
*. Live without the "setup" and "cleanup" process. Because all events are delegated rather than directly bound to the element.
To remove live-bound events, use the Die method
return value
Jquery
Parameters
Type (String): One or more space-delimited event names
fn (function): event handler to bind
Example
Clicking on the generated p still holds the same function.
HTML Code:
<p>click me!</p>
JQuery Code:
Copy Code code as follows:
$ ("P"). Live ("Click", Function () {
$ (this). After ("<p>another paragraph!</p>");
});