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



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

Answer / 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

More jQuery Interview Questions

Is it possible that jquery html work for both html and xml document?

0 Answers  


Is Uncaught TypeError: $(…).modal not a function jquery?

0 Answers  


Define the types of selectors in jquery?

0 Answers  


Tell me can we have multiple document.ready() function on the same page? : jquery mobile

0 Answers  


Explain the use of data-role=”page” attribute? : jQuery Mobile

0 Answers  






Define each() function in jquery?

0 Answers  


What does $("P") will select?

0 Answers  


How to run an event handler only once in jQuery?

0 Answers  


Where jQuery code is getting executed?

0 Answers  


Is numeric in jquery?

0 Answers  


Can we call c# codebehind method using jquery?

0 Answers  


How do you stop the currently-running animation? : jquery mobile

0 Answers  


Categories