jQuery: Targeting elements added via *non-jQuery* AJAX before any Javascript events fire? Beyond th

Posted by peteorpeter on Stack Overflow See other posts from Stack Overflow or by peteorpeter
Published on 2010-03-27T20:50:51Z Indexed on 2010/03/27 20:53 UTC
Read the original article Hit count: 245

Filed under:
|
|
|

Working on a Wicket application that adds markup to the DOM after onLoad via Wicket's built-in AJAX for an auto-complete widget. We have an IE6 glitch that means I need to reposition the markup coming in, and I am trying to avoid tampering with the Wicket javascript... blah blah blah... here's what I'm trying to do:

  1. New markup arrives in the DOM (I don't have access to a callback)
  2. Somehow I know this, so I fire my code.

I tried this, hoping the new tags would trigger onLoad events:

 $("selectorForNewMarkup").live("onLoad", function(){ //using jQuery 1.4.1
    //my code
});

...but have become educated that onLoad only fires on the initial page load. Is there another event fired when elements are added to the DOM? Or another way to sense changes to the DOM?

Everything I've bumped into on similar issues with new markup additions, they have access to the callback function on .load() or similar, or they have a real javascript event to work with and live() works perfectly.

Is this a pipe dream?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-live