4 ms·
care to elaborate a little bit?
by pablasso 14y ago
care to elaborate a little bit?
- mmuro 14y agoHere's a good summary of what's great about .ready(): http://docs.jquery.com/Tutorials:Introducing_$%28document%29.ready%28%29 http://docs.jquery.com/Tutorials:Introducing_$%28document%29... Basically, this is what makes it so great: Everything that you stick inside its brackets is ready to go at the earliest possible moment — as soon as the DOM is registered by the browser. Waiting on the window is actually slower than waiting on the DOM.
- lars 14y agoI don't know that it's all that smart. It uses the DOMReady event in all modern browsers, and uses a load of tricks to get the same behaviour in older browsers. It will never fire before the DOM is ready, like the function in the article does.
- mmuro 14y agoIf you don't want to wait for the DOMReady event, you can always write it like so: (function($) { // $() will work as an alias for jQuery() inside of this function })(jQuery);