Tuesday, November 18, 2008

jQuery Live Query Plugin 1.0

jQuery Live Query Plugin 1.0:

Overview

Live Query utilizes the power of jQuery selectors by binding events or firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.

For example you could use the following code to bind a click event to all A tags, even any A tags you might add via AJAX.

$('a')
.livequery('click', function(event) {
alert('clicked');
return false;
});

Once you add new A tags to your document, Live Query will bind the click event and there is nothing else that needs to be called or done.


Browser Support

Live Query is tested in Safari 2 and WebKit Nightlies, Firefox 1.5 and 2, Internet Explorer 6 and 7 and Opera 9.

Depends On

Live Query depends on jQuery 1.1.3 or higher.