What is the difference between $(document).ready() and window.onload?

$(document).ready()window load
Runs when the HTML DOM is readyRuns when everything is loaded (images, CSS, frames)
FasterSlower
Can be used many timeswindow.onload = keeps only the last function (use $(window).on('load') for many)

Use ready for most code, and load when you need the size of images. See Document Ready Function.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.