Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Live Query jQuery plugin. Ingenious plugin that lets you register jQuery event bindings to be executed when a new element matching the provided selector is added to the DOM. Performance is kept snappy by only running the check after a jQuery DOM manipulation method has been executed (append, prepend, attr etc); it won’t notice elements added using regular DOM methods.

Tagged , , , , ,

2 comments

  1. Seems to me you could fix that problem by adding the event handler to the document and relying on bubbling.

    Jim - 23rd August 2007 00:24 - #

  2. Fantastic article. I seem to end up writing a function that checks to see if methods are already applied to a set of elements, and if not applies my functions. Then when I add new items to the DOM via .append et al, I re-call my function. Yuck.

    Nice find!

    Ross Poulton - 23rd August 2007 01:46 - #

Sign in with OpenID

Auto-HTML: Line breaks are preserved; URLs will be converted in to links.

Manual XHTML: Enter your own, valid XHTML. Allowed tags are a, p, blockquote, ul, ol, li, dl, dt, dd, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, br, pre

A django site