javascript page loaded event code example
Example 1: JavaScript that executes after page load
document.addEventListener("DOMContentLoaded", function(){
});
window.addEventListener("load", function(){
});
Example 2: window.onload execute after load page
window.onload = function() {
setTimeout(loadAfterTime, 5000)
};
function loadAfterTime(){
document.getElementById("menu").style.display="block";
}
Example 3: js document onload
window.onload=()=>{};
Example 4: javascript onload
<body onload="myFunction()">