This article mainly introduces the differences between JQuery's ready function and JS's onload function. If you need it, you can refer to the differences between JQuery's ready function and JS's onload function:
1. execution time
Window. onload can only be executed after all elements including images in the page are loaded.
$ (Document). ready () is executed after the DOM structure is drawn. You do not have to wait until the loading is complete.
2. different numbers of codes
Window. onload cannot be written at the same time. If there are multiple window. onload methods, only one
$ (Document). ready () can be compiled at the same time, and can all be executed.
3. Simplified writing
Window. onload is not simplified
$ (Document). ready (function () {}) can be abbreviated to $ (function (){});
Example:
The Code is as follows:
Http://www.w3.org/TR/html4/loose.dtd>
Differences between onload in ready and js