1// A $( document ).ready() block.
2$( document ).ready(function() {
3 console.log( "ready!" );
4});
5
1jQuery offers several ways to attach a function that will run when the DOM is ready. All of the following syntaxes are equivalent:
2
3$( handler )
4$( document ).ready( handler )
5$( "document" ).ready( handler )
6$( "img" ).ready( handler )
7$().ready( handler )