When the page is opened, we need to perform some operations. If we choose to use jquery at this time, we need to rewrite its 3 methods. I feel that there is no difference
. It depends on personal preference. The second feeling is more Simple and clear:
First type:
Firefox press f12 to debug why not use alert instead of console.log! Everyone should be clear about this!
Second type:
Third Middle:
ps; No need for jquery, the method of initializing the page is,
1. Write onload in the body
2. Write
in the script
Copy code The code is as follows:
window.onload=function(){
//Things to be initialized
}