Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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 :: npm mongoose encryption 
Javascript :: react to string 
Javascript :: shuffle an array of numbers in javascript 
Javascript :: how to pass state values as initial data and support state updates for Formik while using useFormik hook 
Javascript :: get authorization header javascript in my page 
Javascript :: prime numbers 1 to 100 in javascript 
Javascript :: sh: 1: react-scripts: not found 
Javascript :: tocapitalize javascript 
Javascript :: datatable giving default width to colums 
Javascript :: how to check the extension of a file in javascript 
Javascript :: print object key value javascript 
Javascript :: js refresh iframe 
Javascript :: javascript string comma seprated price to int 
Javascript :: getx arguments 
Javascript :: placeholder js 
Javascript :: all javascript pattern programs 
Javascript :: js ceil 
Javascript :: jquery select element with two classes 
Javascript :: js format time 
Javascript :: Html2Canvas screenshot and download 
Javascript :: jquery get radio button checked 
Javascript :: create module in js 
Javascript :: emoji mart npm 
Javascript :: javascript is int in array 
Javascript :: adonis hasone 
Javascript :: js getelementbyid 
Javascript :: javascript array flat 
Javascript :: mysql json array contains 
Javascript :: today date js 
Javascript :: anonymous function jquery 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =