This article is a mirror article of machine translation, please click here to jump to the original article.

View: 10738|Reply: 0

[Jquery] $(document).ready(function(){}) for details

[Copy link]
Posted on 2/13/2019 11:16:07 AM | | |
The difference between document.ready and onload - the JavaScript document load completion event
There are two types of events when the page is loaded
One is ready, which means that the document structure has been loaded (excluding non-text media files such as images).
The second is onload, which indicates that all elements of the page, including images and other files, are loaded.

This is how many people who use jQ start writing scripts:
In fact, this is the abbreviation of jq ready(), which is equivalent to:
//或者下面这个方法,jQuer的默认参数是:“document”;
This is the method of jq ready() is Dom Ready, and its function or meaning is: after the DOM is loaded, you can operate on the DOM.
In general, the order in which a page responds to load is as follows:Domain name resolution - load html - load js and css - load images and other information.
Then Dom Ready should be between "load js and css" and "load other information such as images", and you can operate Dom.





Previous:NetEase's flask full-stack development tutorial
Next:init: function (){}方法的写法原因
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com