Jquery live (type, FN) delegate event implementation

Source: Internet
Author: User

Currently, click, dblclick, mousedown, mouseup, mousemove, Mouseover, mouseout, keydown, keypress, and keyup are supported.
Blur, focus, mouseenter, mouseleave, change, and submit are not supported.
Unlike BIND (), live () can only bind one event at a time.
This method is similar to the traditional bind method. The difference is that using live to bind events will bind events to all current and future elements on the page (using the delegate method ). For example, if you bind a click event to all the likes on the page with live. When a new Li is added to this page, the click event is still available for the newly added Li. Instead of re-binding events to the newly added elements.
. Live () is similar to the popular livequery plug-in, but there are several major differences:
*. Live currently only supports a subset of all events. For the list of supported events, see the preceding description.
*. Live does not support callback functions in the "no event" style provided by livequery .. Live can only be bound to event handlers.
*. Live does not have "setup" or "Cleanup" processes. Because all events are delegate rather than directly bound to elements.
To remove an event bound with live, use the die method.
Return Value
Type (string): one or more event names separated by Spaces
FN (function): The event processing function to be bound.
The P generated by clicking still has the same function.
Html Code :
<P> click me! </P>
Jquery code: Copy code The Code is as follows: $ ("p"). Live ("click", function (){
$ (This). After ("<p> another paragraph! </P> ");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.