Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

What is $(document).ready(function() in jquery


  1. I still get Document ready function fire. Could you please let me know the reason why I am getting Document.ready event before the execution of Window load event.

    $(window).on("load", function () {
    var height = $("#img1").height();

    $("h1").html("Windows Load Height:" + height);
    $(document).ready(function () {
    var height = $("#img1").height();

    $("h1").html("Document Load: Height:" + height);

  2. Why developers mostly use $(document).ready event over windows load event? Even though the windows load event has both DOM and all other contents on the page are loaded rather document ready has only waits for DOM to be loaded.


If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.