|
Be the first user to complete this post
|
Add to List |
window.onload vs document.onload
window.onload
- It is fired when the entire page loads, including its content (images, css, scripts, etc.)
- $(window).load()
document.onload
- It is fired when the DOM is ready which can be prior to images and other external content is loaded
- In general,
document.onloadevent is fired before thewindow.onload - $(document).ready()
Watch the following video to understand this concept with a practical example in detailed!
[youtube https://www.youtube.com/watch?v=-ZsoNb0qwrk]
Also Read:
- Difference between async and defer attributes in script tags
- Making max width work in internet explorer
- Two column layout in css
- Getting started with es6 iterators and iterables
- Array filterUntil function implementation for javascript