Answers for "javascript load after page load"


JavaScript that executes after page load

//two ways of executing JS code after page is loaded, use "DOMContentLoaded" when able

document.addEventListener("DOMContentLoaded", function(){
    //dom is fully loaded, but maybe waiting on images & css files

window.addEventListener("load", function(){
    //everything is fully loaded, don't use me if you can use DOMContentLoaded
Posted by: Guest on July-31-2019

wait for page load js

window.addEventListener('load', function () {

//THE OTHER ANSWER IS WRONG (has a syntax error)
Posted by: Guest on November-07-2020

javascript document load

window.addEventListener("load", function(event) {
    console.log("Tutte le risorse hanno terminato il caricamento!");
Posted by: Guest on October-08-2020

window.onload execute after load page

/* javascript function is executed after 5 seconds page was loaded */
window.onload = function() {
   setTimeout(loadAfterTime, 5000)
function loadAfterTime(){
Posted by: Guest on October-30-2020

call javascript function after page load complete

//for jquery
//after document load
$(document).ready(function() {   //same as: $(function() { 
     alert("hi 1");
//after full window load including image src css file
$(window).load(function() {
     alert("hi 2");
Posted by: Guest on May-29-2020

html tag run only after whole page is loaded

<body onload="script();">
<!-- will call the function script when the body is load -->
Posted by: Guest on September-11-2020

Code answers related to "javascript load after page load"

Code answers related to "Javascript"

Browse Popular Code Answers by Language