Mainstream JavaScript applications are required to run JavaScript code only after the DOM is fully loaded. The fact is: Any DOM object traversal or other operations must be performed after the DOM is loaded. Therefore, the application needs to know when the browser fully loads the DOM. If we use the window. onload event, we must wait for the loading of all page elements-including all images and swf files, and the waiting time is obviously too long. The application requires an event. This event is triggered only when the DOM itself is loaded. Solution jQuery provides a method called ready ()-an event processor typically bound to a document object. The ready () method accepts a function as a parameter. Once the DOM is loaded and can be traversed or other operations, the JavaScript code in the function runs. The following is a simple example. When DOM loading is complete and page elements are not fully loaded, the alert window is displayed. <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">