URL: https://www.progressiverobot.com/jquery-document-ready/

jQuery provides and easy way to run code only when the DOM is fully loaded and ready:

				
					
$( document ).ready(function() {

  // do stuff

});

				
			

Shorthand

ready illustration for: Shorthand

You can also use this shorthand:

				
					
$(function() {

    // do stuff

});

				
			

Wait for the entire page

Use window instead of document to wait until the entire page is ready:

				
					
$( window ).load(function() {

    // do stuff

});