. Loading Interaction Between DOM Javascript and HTML is handled by events triggered by user operations on browser pages. JQuery provides rich event processing mechanisms. From the previous blog, we know that the browser loads the DOM tree first. After loading the DOM elements, the browser begins to add events to the elements. Therefore, you must first understand how the browser loads the DOM. In js, the method for loading DOM is through the window. onload method, while the $ (document). ready () method is used in jQuery. The difference between the two methods is: 1. window. onload () starts to execute the DOM event only when all the elements in the webpage are loaded, and $ (document ). the ready () method can be executed after the DOM tree in the webpage is loaded. For example, if we open a website containing many images. the onload () method starts to run only after all the images on the webpage are loaded ). the lready () method is executed only when the DOM tree is loaded. 2. In terms of writing $ (document). ready (function () {}) can be simplified to $ (function (){}.). 2. Now that event binding is complete, we will naturally start to bind the events we need. How should we bind them? Here is a Demo. Let's take a look at the following Html code. Copy the Code <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">