Hi Yehuda,

Can this approach be extended to JSON data?

I return html content of multiple divs using the pattern...

$("#nlinks2").html(sLinks);

where sLinks is a JSON field.

I cannot work out how to "hook" the call to docReady to this code. Any help here?

Thanks,

Bruce

At 12:46 p.m. 19/01/2007, you wrote:
What I do is apply a context to the function called by document.ready, and use that context in all of the calls I make in it. Then, on load()'s complete, I pass the stuff being updated into that method.

docReady = function(cx) {
  cx = cx || document;
  $("tr:odd", cx).addClass("odd")
}

$(docReady);

$("#container").load(url, function(html) { docReady(html) })

Something like that should work :-D

-- Yehuda

On 1/18/07, Jörn Zaefferer <<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]> wrote:
tmcw schrieb:
> Does jQuery automatically update the DOM after new content is loaded via the
> .load() function? It seems like it's working in some cases and failing on
> others right now. If not, is there a way to manually update it? I'm binding
> a function to links with a certain class on document.ready, but when new
> links are loaded in, they don't trigger the function.
>
You have to reapply the event bindings to elements that you add later to
the DOM, like the ones loaded via load().

See also <http://www.learningjquery.com/2006/09/sacrificial-lambda>http://www.learningjquery.com/2006/09/sacrificial-lambda

--
Jörn Zaefferer

<http://bassistance.de>http://bassistance.de


_______________________________________________
jQuery mailing list
<mailto:discuss@jquery.com>discuss@jquery.com
http://jquery.com/discuss/




--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to