javascript document is ready code example

Example 1: document ready without jquery

document.addEventListener("DOMContentLoaded", function(event) { 
  //we ready baby
});

Example 2: jquery ready

// jQuery document ready function
$(function() {
 // do stuff
});

Example 3: document ready jquery

$(function() {
  // Handler for .ready() called.
});

Example 4: js dom ready function

<!doctype html>
<html>
<head>
</head>
<body>
Your HTML here

<script>
// self executing function here
(function() {
   // your page initialization code here
   // the DOM will be available here

})();
</script>
</body>
</html>