Jquery live () calls a solution that does not exist

Source: Internet
Author: User

In the new version of jquery, the live () method has been deleted, so we will prompt that the function does not exist when calling. js reports an error.

The solution is to use the on () function to replace,

The original statement is:
If you replace it with the on () method, the newly generated element does not have any effect when you click the event again. The new syntax is:
This involves a question: $ ("body") Why is the body here? In fact, we can choose other nodes closer to # company_logo, which will provide better performance. In fact, on () find the # company_logo node in the body, so we can replace it with the # company_logo superior node to achieve better performance.

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.