Uncaught TypeError: jQuery live is not a function

You are currently viewing Uncaught TypeError: jQuery live is not a function

Uncaught TypeError: jQuery live is not a function

jQuery .live() has been removed in version 1.9 onwards.

That means if you are upgrading your jQuery version and something like WordPress, you will notice things breaking if you do not follow the migration guide below. You must not simply replace .live() with .on()!

Example 1:

before:

$('#element a').live('click', function)

after, you move the child element (a) to the .on() selector:

$('#element').on('click', 'a', function)

Example 2:

before:

$('.element').live('click', function)

after, you move the element (.element) to the .on() selector, and find the nearest parent element (preferably with an ID):

$('#parentElement').on('click', '.element', function)

If you do not know what to put as the parent, body always works:

$('body').on('click', '.element', function)