Differences between JQuery's ready function and JS's onload: 1. the execution time window. onload must wait until all the elements in the page including images are loaded. $ (Document). ready () is executed after the DOM structure is drawn. You do not have to wait until the loading is complete. 2. Write a number of different windows... SyntaxH
Differences between JQuery's ready function and JS's onload:
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:
Http://www.w3.org/TR/html4/loose.dtd>
Differences between onload in ready and js