Home  >  Article  >  Web Front-end  >  Three commonly used methods for initializing jQuery page loading_jquery

Three commonly used methods for initializing jQuery page loading_jquery

WBOY
WBOYOriginal
2016-05-16 16:46:221120browse

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:

Copy code The code is as follows:



Copy code The code is as follows:



Firefox press f12 to debug why not use alert instead of console.log! Everyone should be clear about this!
Three commonly used methods for initializing jQuery page loading_jquery
Second type:
Copy code The code is as follows:



Three commonly used methods for initializing jQuery page loading_jquery
Third Middle:
Copy code The code is as follows:




Three commonly used methods for initializing jQuery page loading_jquery
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
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn