document load event code example
Example 1: JavaScript that executes after page load
document.addEventListener("DOMContentLoaded", function(){
});
window.addEventListener("load", function(){
});
Example 2: window.onload
window.onload = function() {
};
Example 3: dom is loaded
document.addEventListener('DOMContentLoaded', (event) => {
console.log('DOM fully loaded and parsed');
});
Example 4: javascript document load
window.addEventListener("load", function(event) {
console.log("Tutte le risorse hanno terminato il caricamento!");
});
Example 5: document.addEventListener("load", function () {
window.addEventListener('load', (event) => {
console.log('page is fully loaded');
});
window.onload = (event) => {
console.log('page is fully loaded');
};
Example 6: document load javascript
window.onload = function() {
}