document.load code example

Example 1: call a function on load jquery

$(document).ready(function () {
  // Function code here.
});

Example 2: document ready without jquery

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

Example 3: javascript document load

window.addEventListener("load", function(event) {
    console.log("Tutte le risorse hanno terminato il caricamento!");
});

Example 4: jquery onload event

// A $( document ).ready() block.
$( document ).ready(function() {
    console.log( "ready!" );
});

Example 5: document. ready

$( document ).ready(function() {
    console.log( "ready!" );
});

Example 6: document.addEventListener("load", function () {

window.addEventListener('load', (event) => {
  console.log('page is fully loaded');
});

window.onload = (event) => {
  console.log('page is fully loaded');
};