+ 1

Window.onload function

Can someone explain what is this function( window.on load). It's use and function and when it is to be used?

22nd Aug 2020, 7:14 PM
Dushyant Kumar Tyagi
Dushyant Kumar Tyagi - avatar
2 Answers
+ 7
The onload event triggers when the window object has been loaded. For more details you can refer to the MDN: https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
22nd Aug 2020, 7:27 PM
Gabriele
Gabriele - avatar
+ 4
window.onload is an event which activate when html content downloaded . Generally used here in sololearn to solve refrence error.as window.onload = ()=>{ //Js code } Mean run my js code after loading html
22nd Aug 2020, 7:29 PM
Divya Mohan
Divya Mohan - avatar