I could be mistaken here, but doesn't jQuery (or javascript for that
matter) need the DOM to be loaded before you can start selecting
things from it?
You could put the script elsewhere on the page, but you're still going
to have to wait for that div to load before you can change its
contents. If you to insert content before the page loads, you're going
to have to use some server-side programming, not javascript.

- Chris


On Nov 5, 11:12 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> If you don't want to put a script after the div it won't get any
> faster then DOM ready.
>
> You could although poll for that element. Say it had an id of
> 'asap' (untested):
>
> (function() {
>     var f = function() {
>         var div = document.getElementById('asap');
>         if (div) {
>             // alter content here...
>         } else {
>             setTimeout(f, 30);
>         }
>     };
>     f();
>
> })();
>
> --Klaus
>
> On 5 Nov., 16:30, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I want to change the content of a div asap.
>
> > I know about document.ready, but if possible I'd rather do this
> > earlier. I'd also rather do it as an event instead of loading a script
> > file after the div appears in the page.
>
> > I tried the load() event, but this didn't seem to fire at all.
>
> > Anyone got any tips on this?
>
>

Reply via email to