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

What is jQuery connect?

442


How can you add a jquery library in your project?

431


Explain the difference between .empty() and .remove() ?

449


What is method chaining in jquery and what are the advantages?

425


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

445






What is the difference between text() and html() in jquery?

442


Is jquery a w3c standard? : jquery mobile

518


What is the difference between $.map and $.grep in jQuery?

472


How do you select all elements with the class of “selected” in jquery?

436


How does jquery mobile theming work? : jquery mobile

432


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

481


Tell me is jquery a library for client scripting or server scripting? : jquery mobile

459


Explain the types of selectors in jquery?

486


Explain cdn? : jquery mobile

488


How to disable/enable an element with jQuery?

470