[jQuery] Running script onLoad instead of ready
Maybe I'm missing something totally obvious, but I was trying to get
an alert to fire after some of the page loads, (but before ().ready).
I tried the following:
$('body').load( function( ) { alert('Hello World'); } );
with no effect.
I also tried it with some of the other elements on the page. Also
with no effect.
But the following works perfectly, albeit a little later than I'd
like:
$(document).ready( function( ) { alert('Hello World'); } );
Basically, what I'm trying to do, is to get the alert to fire a tad
sooner for pages that might take a while to load completely, but not
quite as soon as it would if I just put the naked alert in some script
tags.
Am I missing something?