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

Which one is more efficient, document.getelementbyid( "idname") or $("#idname)?

0 Answers  


Explain .bind() vs .live() vs .delegate() vs .on()

2 Answers  


Explain deferred and promise object in jquery? : jquery mobile

0 Answers  


How you get server response from an ajax request using jquery?

0 Answers  


What is the use jQuery.data method?

0 Answers  






How we can check if an element is empty or not using jquery?

0 Answers  


Can we use protocol less URL while referencing jQuery from CDNs?

1 Answers  


Explain remove class jquery with example?

0 Answers  


Is jquery a w3c standard? : jquery mobile

0 Answers  


How to create, read and delete cookies with jquery?

0 Answers  


Which version of jquery file should be used?

0 Answers  


What is the difference between $(window).load and $(document).ready function in jquery?

0 Answers  


Categories