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 the common methods of sending a request to a server.

464


Difference between javascript and jquery? : jQuery Mobile

450


Can you please explain the difference between .js and .min.js? : jquery mobile

392


In what scenarios jQuery can be used?

496


Can you please explain the difference between javascript and jquery? : jquery mobile

423






What is the use of serialize method in jQuery?

482


What are the difference between alert() and confirm()?

450


How you will use jquery means requirement needed for using jquery.

417


What are the different types of selectors?

462


What does dollar sign mean in jquery? : jQuery Mobile

448


Explain jquery.noconflict? : jquery mobile

458


What is a cdn? What are the advantages of using cdn?

398


Can you please explain the difference between event.preventdefault and "return false"? : jquery mobile

463


Can you give me a brief history of your programming days? Where did it all start?

587


How does jquery mobile theming work? : jquery mobile

426