1// A jQuery( document ).ready() block.
2jQuery( document ).ready(function() {
3 console.log( "ready!" );
4});
1document.addEventListener("DOMContentLoaded", function(event) {
2 //we ready baby
3});
1// A $( document ).ready() block.
2$( document ).ready(function() {
3 console.log( "ready!" );
4});
5
1The .ready() method is typically used with an anonymous function:
2$( document ).ready(function() {
3 // Handler for .ready() called.
4});
5
6Which is equivalent to the recommended way of calling:
7$(function() {
8 // Handler for .ready() called.
9});