Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

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.


It would be great if you can help share these free resources