Yep. I think there should be a way to encapsulate it, but I'll have to give
it more thought. I use this technique in an app that has some people
insisting on using Prototype, and the great thing is that they can use it
to. They simply call docReady("#theirId")
-- Yehuda
On 1/18/07, Justin Carter <[EMAIL PROTECTED]> wrote:
On 1/19/07, Yehuda Katz <[EMAIL PROTECTED]> 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
That's a great tip Yehuda! Keeps everything contained in 1 nice function
:)
cheers,
Justin
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
Yehuda Katz
Web Developer | Wycats Designs
(ph) 718.877.1325
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/