The question says it all. Which one is better and when to use what, I never use jQuery live() as I am using liveQuery plugin for a couple of years, I am used to it and still continue using it. But I want to know the subtle differences between the two and when to use each of it?
Share
The “live” function native to jQuery leverages the bubbling of events up the DOM. The “liveQuery” plugin, by contrast, uses the selector to find elements in the DOM and attach event handlers directly.
In my opinion you’re way better off using the “live” function when possible, because it involves less DOM traversal etc. For example, hooking event handlers to things throughout a big table can be kind-of slow with liveQuery but not slow at all with “live”. There may be some issues (with IE of course) that force you to use liveQuery sometimes, though jQuery 1.4 has improved “live” considerably.
edit — Update: Sep 2017
At this point, modern versions of jQuery centralize event handler registration in the
.on()API. Briefly:would today be written with
.on():The
.on()API provides considerably more flexibility than the long-deprecated.live()method did, including the option of using any node in the DOM as the delegation point (like the old.delegate()did).