Add events to content dynamically generated by jquery

Source: Internet
Author: User

How do I add events to dynamically created nodes? For example, in the following case, if you want to add a click event for a node with a dynamically generated id of del, you can write it as follows:

$ ('# Del'). live ('click', function () {alert ('obtained ');});

In fact, we mainly use the live method. For details about this method, refer to this article: jQuery adds event responses to dynamically generated content (jquery live Method Introduction)

Articles you may be interested in
  • JQuery adds Event Response to dynamically generated content (jquery live Method Introduction)
  • Simple Example of php getting webpage content through socket
  • How to Use jquery to control the display of user-uploaded pictures with too much width
  • How does jquery bind events to dynamically created nodes?
  • Js obtains the height of the scroll bar from the top and bottom of the browser. It is compatible with ie and firefox.
  • Jquery drop-down menu (ultra-simple and practical, compatible with mainstream browsers such as IE and firefox)
  • Jquery checks whether the page has been loaded with the jquery File
  • Js dynamically creates html content

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.