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

html load script after page load

<script defer src="app.js"></script>
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 :: react native build aab 
Javascript :: react native rename 
Javascript :: js replace space with underscore 
Javascript :: update all packages in package.json 
Javascript :: javascript void(0) href 
Javascript :: javascript get random boolean 
Javascript :: jspdf cdn 
Javascript :: javascript get random array value 
Javascript :: js new date tomorrow 
Javascript :: ondomcontentloaded javascript 
Javascript :: change input placeholder text jquery 
Javascript :: request to https://registry.npmjs.org/webpack failed, reason: unable to get local issuer certificate 
Javascript :: mongodb check for array not empty query 
Javascript :: jquery on enter key pressed 
Javascript :: angular validators number only in reactive form 
Javascript :: javascript redirect laravel route 
Javascript :: dimensions react native 
Javascript :: js loop every second 
Javascript :: open websute react native 
Javascript :: counter cdn 
Javascript :: js replace space with dash 
Javascript :: sweet alert after click ok redirect 
Javascript :: javascript celcius to farenheit 
Javascript :: vertical align center react native view 
Javascript :: how to store objects in localstorage 
Javascript :: check for internet explorer browser in javascript 
Javascript :: angular npm angular material 
Javascript :: how to refresh slick after tab function 
Javascript :: vue 3 cdn 
Javascript :: js match alphabet 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =