How to bind jQuery events to on (), bind (), and delegate () _ jquery

Source: Internet
Author: User
This article mainly introduces three methods for binding jQuery events, namely on (), bind (), and delegate (), which are very easy to understand. For more information, see. After a few days of js-related learning, some people use bind (), some use on (), some use delegate (), some people also use live (). When reading the code, they thought that all the functions were implemented, but they didn't fully understand the differences. So today, I checked the information and made a summary.

The reason why there are so many types of binding methods is that jQuery versions are updated. For example, the on () method will appear after 1.7.

On the jQuery event binding api page, the live () method is outdated and is not recommended. So here we mainly look at the following three methods: bind (), delegate (), on ()

We prepare an html page for testing various types of event binding.

 
Related Article

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.