on document load code example
Example 1: document ready
$( document ).ready(function() {
console.log( "ready!" );
});
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: document on load
$(window).on('load', function() {
console.log('All assets are loaded')
})
Example 5: on load javascript
window.onload = (event) => {
console.log('page is fully loaded');
};
Example 6: on load javascript
window.addEventListener('load', (event) => {
console.log('page is fully loaded');
});