window on ready code example
Example 1: js vanilla dom ready
document.addEventListener("DOMContentLoaded", function() {
// code
});
Example 2: jquery on window ready
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "ready!" );
});