The above three codes perform the same action, which is convenient to write , so Jquery is more popular than other applications, but when used with other js libraries, especially when prototype.js is used at the same time, the $ method cannot be used because they also have this method. You can use the following method to avoid this Conflict:
They are all operations performed after the Dom is loaded, so they can be placed anywhere in the html, but some For example, the loading event method mentioned in the previous section
This is executed during the loading process Yes, the relevant elements must be loaded before they can be executed. It will be much more flexible if you put them into the above code
Then this loading event can be placed anywhere...