1.

What is the exact difference between the methods onload() and document.ready()?

Answer»

The onload() and document.ready() methods are used to load and render the HTML and JavaScript code that is needed to display the page.  However, they are different methods in that they use different approaches to loading the HTML and JavaScript code. The exact differences are -

onload()document.ready()
The onload() method is used to load the HTML code.The document.ready() method is used to load the JavaScript code.
The onload() method loads the HTML code using a pre-compiled object that is passed to the onload event handlerThe document.ready() method loads the JavaScript code using a pre-compiled object that is passed to the document.ready event handler.



Discussion

No Comment Found