Simple use of jQuery
Add jQuery to the web page
##There are many ways to add jQuery to the web page. You can use the following methods:
- Download jQuery library from jquery.com
- Load jQuery from CDN, such as loading jQuery from Google
#Download jQuery
There are two versions of jQuery available for download:
-
Production version - used in actual websites, has been streamlined and compressed.
- Development version - for testing and development (uncompressed, readable code)
- Both versions above are available from jquery .com.
The jQuery library is a JavaScript file that you can reference using the HTML
Note: You can use jQuery by placing the downloaded file in the same directory of the web page.
alternative plan
If you don't want to download and store jQuery, you can also reference it through a CDN (Content Delivery Network).
The servers of Baidu, Youpaiyun, Sina, Google and Microsoft all have jQuery.
If your site users are domestic, it is recommended to use domestic CDN addresses such as Baidu, Youpaiyun, Sina, etc. If your site users are foreign, you can use Google and Microsoft.
Note: All examples on this site use Baidu jQuery CDN library.
Example:
php.cn 欢迎大家来到php.cn