The live() method was deprecated in jQuery 1.7. The jQuery docs now recommend
Use
.on()to attach event handlers. Users of older versions of jQuery should use.delegate()in preference to.live().
I understand how on and delegate work, but I don’t understand why they are better. live() is simpler and easier to use.
Is there a reason why live was deprecated? How are the other methods better? Will anything bad happen if I continue to use live?
See some of the explanations here:
Quote:
You can’t use
.live()for reusable widgets..stopPropagation()doesn’t work with live..live()is slower..live()is not chainable.Further beauty of
.on()is that it streamlines all events quite well: http://api.jquery.com/on/D’uh you know about the api link and see how
.on()works 🙂Quote: