Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

window.onload execute after load page

/* javascript function is executed after 5 seconds page was loaded */
window.onload = function() {
   setTimeout(loadAfterTime, 5000)
}; 
 
function loadAfterTime(){
   document.getElementById("menu").style.display="block";
}
Comment

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");
});
Comment

call javascript function after page load complete

document.addEventListener('readystatechange', event => { 

    // When HTML/DOM elements are ready:
    if (event.target.readyState === "interactive") {   //does same as:  ..addEventListener("DOMContentLoaded"..
        alert("hi 1");
    }

    // When window loaded ( external resources are loaded too- `css`,`src`, etc...) 
    if (event.target.readyState === "complete") {
        alert("hi 2");
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript got to url 
Javascript :: javascript detect escape key 
Javascript :: jquery accept only excel file 
Javascript :: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery 
Javascript :: check if string only contains integer digits numbers javascript 
Javascript :: json object length in javascript 
Javascript :: enable button jquery 
Javascript :: javascript replace all space 
Javascript :: media query js 
Javascript :: dom loaded event 
Javascript :: react-native how to get size of screen 
Javascript :: how to start json server in particular port 
Javascript :: select2 in modal not work 
Javascript :: regex check if number is even 
Javascript :: react native rotate 
Javascript :: how to restart elasticsearch node 
Javascript :: Append text into a file nodejs 
Javascript :: loop through object jquery 
Javascript :: how to change a css variable with javascript 
Javascript :: counterup2.js cdn 
Javascript :: javascript replace space with minus 
Javascript :: swal is not defined 
Javascript :: generating component in angular without spec file 
Javascript :: javascript gcd 
Javascript :: html5 store object in localstorage 
Javascript :: get children length jquery 
Javascript :: javascript roman to integer 
Javascript :: how to extract domain name of url of current page in javascript 
Javascript :: reset a select option jquery 
Javascript :: alphabet regex js 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =