javascript page is loaded code example
Example 1: JavaScript that executes after page load
document.addEventListener("DOMContentLoaded", function(){
});
window.addEventListener("load", function(){
});
Example 2: html tag run only after whole page is loaded
document.onload = function {
}
window.onload = function {
}
Example 3: js on page loaded
window.onload = function() {
yourFunction(param1, param2);
};
Example 4: how to check if page is loaded in javascript
<body onload="onload()">
<div>
<p>TEXT</p>
</div>
</body>
<script>
function onload(){
console.log("Window Has Been Loaded!")
}
</script>