Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
jQuery live function
Play lesson

jQuery tutorial for beginners - jQuery live function

5.0 (2)
25 learners

What you'll learn

This course includes

  • 22.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Link for all dot net and sql server video tutorial playlists https://www.youtube.com/user/kudvenkat/playlists?sort=dd&view=1 Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2015/05/jquery-live-function.html Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1 In this video we will discuss jQuery live() and die() functions. We discussed how to perform event delegation, using on() method in Part 36 and using delegate() method in Part 37. Another way to perform event delegation is by using live() function. With on() and delegate() functions the event gets bubbled up to the specified parent element, where as with live() function the event gets bubbled up all the way to the document object. The example that we worked with in Part 37 and Part 38 is rewritten using live() and die() functions as shown below. Notice that, to perform event delegation we are using live() function and to stop event delegation we are using die() function. <html> <head> <title></title> <!--<script src="jquery-1.11.2.js"></script>--> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js"> </script> <script type="text/javascript"> $(document).ready(function () { $('li').live('click', function () { $(this).fadeOut(500); }); $('#btnAdd').on('click', function () { $('ul').append('<li>New List Item</li>'); }); $('#btnUndelegate').on('click', function () { $('li').die('click'); }); }); </script> </head> <body style="font-family:Arial"> <input id="btnAdd" type="button" value="Add a New List Item" /> <input id="btnUndelegate" type="button" value="Undelegate" /> <ul> <li>List Item</li> <li>List Item</li> </ul> </body> </html> live() function is deprecated in jQuery 1.7 and completely removed in jQuery 1.9. Everything that can be achieved with the following methods can be achieved by using .on() function. live() bind() delegate() So, if you are using jQuery 1.7 or higher version, jQuery recommends to use on() function. Please note : Older versions of jQuery can be found on the Microsoft CDN http://www.asp.net/ajax/cdn

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere