ayumee
7/31/2017 - 6:56 PM

Document ready & window load

Document ready, shorthand for document ready and window load.

<html>
<head>
    <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script>
    $( document ).ready(function() {
        console.log( "document loaded" );
    });
    
    // Shorthand for $( document ).ready()
    $(function() {
        console.log( "document loaded" );
    });
 
    $( window ).on( "load", function() {
        console.log( "window loaded" );
    });
    </script>
</head>
<body>
    test
</body>
</html>