😛jQuery 1.9 .live,.delegate,.on is not a function (ok)
Last updated
Last updated
C:\xampp82\htdocs\scholarsprep\wp-content\themes\kadence-child\assets\admin\js\dev-admin-custom.js
I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the .live()
stops working.
I get the error TypeError: $(...).live is not a function
.
Is there any method I can use in place of .live()
?
1Does this answer your question? Turning live() into on() in jQuery – djg CommentedSep 28, 2022 at 5:38
Related post - Uncaught TypeError: $.ajax(...).error is not a function. .error
is another jQuery function which got deprecated in jQuery v3.x – RBT CommentedOct 7, 2022 at 9:38
Sorted by: Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 629
.live()
has been removed in version 1.9 onwardsThat means if you are upgrading from version 1.8 and earlier, you will notice things breaking if you do not follow the migration guide below. You must not simply replace .live()
with .on()
!
For quick/hot fixes on a live site, do not just replace the function live
with on
,
as the parameters are different!
should map to:
The (child) selector is very important! If you do not need to use this for any reason, set it to null
.
before:
after, you move the child element (a
) to the .on()
selector:
before:
after, you move the element .myButton
to the .on()
selector, and find the nearest parent element (preferably with an ID):
If you do not know what to put as the parent, document
always works:
ShareFollowedited Jun 10, 2014 at 13:03Samuel Liew78.4k110110 gold badges165165 silver badges273273 bronze badgesasked Jan 16, 2013 at 8:26ngplayground21.2k3737 gold badges9797 silver badges174174 bronze badges