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() removedThe .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.