The difference between Document.ready and onload--javascript document load Completion event page load complete there are two kinds of events, one is ready, the document structure has been loaded complete (not including pictures and other non-text media files) The second is the onload, Indicates that all elements, such as a page containing pictures, are loaded and completed.
A lot of people with JQ start writing scripts like this:
$ (function () {//Do something}); In fact this is the shorthand for 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 JQ ready () method is Dom ready, his role or significance is that the DOM after the completion of the DOM can be manipulated. In general, the first page response load order is: Domain name resolution-load html-load js and css-loading pictures and other information. Dom ready should be able to manipulate the DOM between "load JS and css" and "load pictures and other information".