Is there any difference between body onload() and document.ready() function?

Answer Posted / chaitanya

document.ready() function is different from body onload() function for 2 reasons.

We can have more than one document.ready() function in a page where we can have only one body onload function.

document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain bind() vs live() vs delegate() methods in jquery

446


Define the use of each function in jquery?

439


What is the struts2 jquery plugin and its advantages.

503


How can related code be encapsulated?

498


What is .bind()? : jquery mobile

474






How to debug jQuery?

590


How can you delay document.ready until a variable is set?

501


Explain jquery filter?

829


How to find all sibling elements in front of the current element using ?

508


What is the difference between map and grep function in jquery?

483


How did you become the creator of jquery ui? Whats the story behind that?

753


Is jQuery a programming language?

482


Explain cdn in jquery?

4164


What is the use of jQuery.ajax method ()?

473


Why should I use jquery?

453