livequery
is an entirely different concept from .live()
.
The .live()
method uses event delegation to handle events that occur anywhere on the page.
livequery
will invoke handlers when DOM changes occur (via jQuery methods).
For the example below, when an element with class="some_class"
is added to the DOM (or the class is added to an element), the first handler will run. When removed, the second.
$('.some_class').livequery( function() {
// apply a plugin to the element
$(this).somePlugin();
}, function() {
// clean up after the element was removed
});
There should be little actual need for livequery
, but in that rare case where you need to respond to DOM changes, and have no control over the jQuery that is causing those changes, it can be useful.
DOMNodeInserted
your either building a complex templating system or your doing it wrong. If the former then just build a simple templating system instead – Catgut