Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between $document.ready() and $window.load() in jQuery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 116
    Comment on it

    Hello Readers,


    Usually, we use the jQuery in our web project as per the requirement. We start the jQuery syntax as $(document).ready() OR $(window).load() function.
    Here I will describe the difference between $(document).ready() and $(window).load() functions.

    The load function executes after all the content on the page fully loaded including document object model(DOM) content, frames, asynchronous javascript and images.


    Here is the example of jQuery load function:

    $(window).load(function () {
             alert("window load complete");
    });
    


    The ready function executes a bit earlier then window.load function


    Jquery $(document).ready() function event executes a bit earlier than $(window).load() function and it will be call once the DOM is loaded on the page. DOM(document object model) means all the html script/tags/ like (table, anchor tag, paragraph tag, div tag etc..). It does not wait for the frames, images to get fully load. It means that it is the earliest stage in page load process. It means that it is the initial phase within page load process.

    Here is the example of jQuery load function.

    $(document).ready(function () {
             alert("DOM has been loaded!");
    });
    


    Thanks

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: