window.onload = function() {
// Some code
};
//Use window.onload to to execute JavaScript only after the HTML has loaded
//Syntax:
window.onload = function() {
//JavaScript goes here
}
//How to load function after the page has loaded?
window.addEventListener('load', function() {
console.log('All assets are loaded')
})
window.addEventListener('load', () => {
// Some code
}, false);
window.addEventListener("load", (event) => {
// insert code here
});
//How to load the function after the window has loaded?
$(window).on('load', function() {
console.log('All assets are loaded')
})
window.onload = function() {
init();
doSomethingElse();
};
window.onload = function() {
init();
doSomethingElse();
};
function load(argument) {
// body...
}
window.onload = load;