jquery's live() is deprecated. What do I use now?

I saw on the jquery documentation that live() is deprecated. Is there a direct replacement function?

Answers:

Answer

Of course:

http://api.jquery.com/on/

http://api.jquery.com/off/

The page for live() shows how to convert to on():

http://api.jquery.com/live/

Answer

$(document).on('event', 'selector', function() {}); replaces .live().

$('selector').on('event', 'selector', function() {}); replaces .delegate().

$('selector').on('event', function() {}); replaces .bind().

Answer
$('rootselector').on('click', 'selector', function(){
});

taken from http://api.jquery.com/on/

Answer

You can have a look on all the deprecated functions of jquery depending on their versions

http://api.jquery.com/category/deprecated/

Hope this helps you.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.