Comparing Window Load And Document Ready

  • Jquery provides Document Ready function which gets trigger once the DOM(Document Object Model).
  • Java Script has native load event which gets triggered when everything is loaded in browser including images.
  • "WINDOW" is one of the browser object.  "this" operator generally refers to window object.The other objects of browser are :-
  •  In this Demo, "We are running  some code on both the events to check which events get triggered fast".
  • The code file is document-ready-demo.html ,
<!DOCTYPE html>
        <title>Dom Ready And Window Load</title>
            .about {
            .dom-ready {
            .window-load {
        <ol id="statistic">
            <li class="about">Testing Widows Load And Jquery Document ready</li>
        <script src="./lib/jquery-1.9.0.min.js"></script>
            $(document).ready(function () {
                var statistic = "<li class='dom-ready'>Jquery Document ready function executed : " + new Date().getMilliseconds() + "</li>";
             window.onload = function () {
                var statistic = "<li class='window-load'>Window Load function executed : " + new Date().getMilliseconds() + "</li>";

  • The firebug console output ,

  • The Browser output,
  • This shows Jquery Document ready function triggered first then window load.

Demo Code Download:- 

Demo Code Download Link