The jQuery library can be added to a web page with a simple line of markup.
There are many ways to add jQuery to a web page. You can use the following methods:
Download the jQuery library from jquery.com
Load jQuery from a CDN, such as from Google Load jQuery
Download jQuery
There are two versions of jQuery available for download:
Production version - used in the actual website, has been streamlined and compressed.
Development version - for testing and development (uncompressed, readable code)
Both versions above are available from jquery .com download.
Easier way to use jQuery
If you don’t want to download and store jQuery, you can also use CDN (content distribution network) to reference it. We only need to quote jQuery from Baidu, Youpaiyun, Sina, Google or Microsoft and put themin the <head>
下面是个各大网站的CDN
Baidu CDN:
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
</head>
又拍云 CDN:
<head>
<script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.2.min.js">
</script>
</head>
新浪 CDN:
<head>
<script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js">
</script>
</head>
Google CDN:
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
</head>
##Tips: It is not recommended to use Google CDN to obtain the version, because Google products are very unstable in China. If you observe what's on the Google URL - the jQuery version (1.8.0) is specified in the URL. If you wish to use the latest version of jQuery, you can also remove a number from the end of the version string (such as 1.8 in this example) and Google will return the latest available version in the 1.8 series (1.8.0, 1.8.1, etc.), or It is also possible to leave only the first number, and Google will return the latest available version in the 1 series (from 1.1.0 to 1.9.9).
Note:The examples on this site all use Baidu jQuery CDN library .