Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
BRH 48
#DOTNET 34
#ASP.NET 29
jQuery 22
ASP.NET 20
.NET 20
WPF 9
jquery interview questions 9
jquery faq 8
ASP.NET4 8

Archive · View All
February 2011 10
September 2011 4
August 2011 4
July 2011 4
May 2011 4
April 2011 4
March 2011 4
October 2011 4
June 2011 4
January 2011 4

Does document.ready() function similar to onload()? (or) Explain the importance of document.ready()? (or) Why jQuery script is

Feb 9 2011 4:44AM by Hima   

Document.ready() function is completely different from body onload() function .

Explanation

JavaScript Operations on the page elements are performed outside of the DOcument Markup (DOM) that creates them. This is because of waiting until  DOM elements of the page are fully loaded before those operations execute. The onload handler for the window object is used for this purpose, executing statements after the entire page is fully loaded.
Browser delays calling onload till DOM tree is created and then  all images/other external resources are fully loaded.

jQuery waits until DOM tree is ready before executing scripts. jQuery uses this approach using Document.Ready . This makes running scripts fast. jQuery triggers execution of code once the DOM tree is loaded , but not external image resources has loaded.  Hence script execution need not wait till the page is loaded. The code execution happens before page is loaded hence jQuery code is faster. We can use this technique multiple times within the same HTML document.

To summarize the differences

  • First of all Document.ready() function is called as soon as DOM is loaded but body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.
  • We can have as many document.ready() functions in a page but onload function is limited on one time.

Tags: BRH, jQuery, jquery faq, document.ready, onload(), jQueryinterview questions, dom,


Hima
31 · 6% · 1776
3 Readers Liked this
chetan_sudra Liked this on 1/3/2012 5:20:00 AM
Profile · Facebook
Adam Tokarski Liked this on 7/9/2012 2:45:00 AM
Profile
Ravikumar Liked this on 7/10/2012 7:37:00 AM
Profile
3
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Does document.ready() function similar to onload()? (or) Explain the importance of document.ready()? (or) Why jQuery script is " rated 5 out of 5 by 3 readers
Does document.ready() function similar to onload()? (or) Explain the importance of document.ready()? (or) Why jQuery script is , 5.0 out of 5 based on 3 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]