Error Uncaught TypeError: $ (...). live is not a function (...) JQuery 1.9 and later do not support. live (), uncaught. live

Source: Internet
Author: User

Error Uncaught TypeError: $ (...). live is not a function (...) JQuery 1.9 and later do not support. live (), uncaught. live

When $ ("# a"). live () is used, chrome prompts Uncaught TypeError: $ (...). live is not a function (...), I searched it online and found that jQuery 1.9 does not support the. live function anymore. My jQuery version is 1.11.

The official API documentation is described as follows:

Https://jquery.com/upgrade-guide/1.9/#live-removed

.live() removed

The .live() method has been deprecated since jQuery 1.7 and has been removed in 1.9. We recommend upgrading code to use the .on()method instead. To exactly match $("a.foo").live("click", fn), for example, you can write $(document).on("click", "a.foo", fn). For more information, see the .on() documentation. In the meantime, the jQuery Migrate plugin can be used to restore the .live() functionality.

Therefore, if the previous. live statement is$("a.foo").live("click", fn), You need to change$ (Document). on ("click", "a. foo", fn), where fn is the callback function of the event. To ensure that the old code runs correctly, you can also use the Migrate plug-in of jQuery.

 

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.