the difference between Document.ready and onload--javascript document load completion eventThere are two kinds of events for page load completionOne is ready, indicating that the document structure is loaded (not including non-text media files such as pictures)The second is onload, which indicates that all elements, including pictures and other files, are loaded and completed. A lot of people who use JQ have started writing scripts like this:$(function() { //Do something});In fact, this is the abbreviation of JQ Ready (), which is equivalent to:
$(document). Ready(function() {
//do something})//or the following method, the default parameter of Jquer is: "Document";
$ (). Ready (function() {
//do something})This is the method of JQ ready (), which is the DOM, and his role or meaning is that the DOM can be manipulated after the DOM has been loaded. in general, the first page response loading order is: Domain name resolution-loading html-loading JS and css-loading pictures and other information. then Dom ready should be able to manipulate the DOM between "Loading JS and css" and "Loading pictures and other information".
$ (function () {}) and $ (document). The difference between ready (function () {})