Hi,

> Essentially, anything that interacts with or manipulates the page must
> be within the $(document).ready() function. This is considered a "best
> practice" - the only alternative is to wrap your code in a
> $(window).load( ... ), but that is highly un-optimal.

You could also put the script tag at the end of the document and load a 
script like this (not tested, just written for the mail now):

(function() {
        var f = arguments.callee;
        if( (document.getElementsByTagName && 
document.getElementsByTagName('body')) ||
            document.body )
                f = function() {
                        // do all the things you whant
                };
        else setTimeout(f,10);
})();

When your script-tag is evaluated, all the other tags have already been 
evaluated. You just have to wait for those browsers that put the childnodes 
in after they are complete, which should be OK as soon as <body> is available.

But why should you do all that stuff if you simply can put the script tag 
wherever you whant and use $(document).ready(...)? As you see using 
$(document).ready(...) is definatelly a best practice :-)

Christof

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

Reply via email to