document loaded javascript code example
Example 1: listerner content loaded js
window.addEventListener('DOMContentLoaded', (event) => {
console.log('DOM fully loaded and parsed');
});
Example 2: dom ready js
document.addEventListener("DOMContentLoaded", function() {
// code
});
Example 3: window.onload
window.onload = function() {
// Some code
};
Example 4: dom is loaded
document.addEventListener('DOMContentLoaded', (event) => {
console.log('DOM fully loaded and parsed');
});
Example 5: javascript document load
window.addEventListener("load", function(event) {
console.log("Tutte le risorse hanno terminato il caricamento!");
});
Example 6: document load javascript
window.onload = function() {
// Code here
}