Adding jQuery page
There are several ways to add jQuery in a web page. You can use the following methods:
- From jquery.com download the jQuery library
- Loading jQuery from CDN, when you load jQuery from Google
There are two versions of jQuery are available for download:
- Production version - used for the actual site has been streamlined and downsized.
- Development version - for testing and development (uncompressed, readable code)
These two versions are available from jquery.com download.
<Script src = "jquery-1.10.2.min.js"> </ script>
Tip: Download files in the same directory as the page, you can use jQuery.
If you do not want to download and store jQuery, it can also refer to it by CDN (Content Distribution Network).
Baidu, they shoot clouds, Sina, Google and Microsoft servers all have jQuery.
If your site is the user, it is recommended to use Baidu, they shoot clouds, Sina and other domestic CDN address, if you are an overseas site users can use Google and Microsoft.
Note: Examples of this site are used Baidu jQuery CDN library.
For from Baidu, they shoot clouds, Sina, Google or Microsoft cited jQuery, use one of the following codes:
This tutorial CDN:
<Script src = "http://cdn.static.w3big.com/libs/jquery/1.10.2/jquery.min.js">
<Script src = "http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
Shoot Cloud CDN:
<Script src = "http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.2.min.js">
<Script src = "http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js">
<Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
|To get the latest version available through Google CDN:|
Is not recommended to use Google CDN to get the version of the product is very unstable because of Google in China.
If you observe what the Google URL - specifies the jQuery version (1.8.0) in the URL. If you want to use the latest version of jQuery, you can also delete a number from the end of the version string (for example, in this case 1.8), Google returns 1.8 series in the latest available version (1.8.0,1.8.1 etc.), or may be only the first number, then Google will return a series of the latest available version (from 1.1.0 to 1.9.9).
<Script src = "http://ajax.htmlnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js">
|Use Baidu, they shoot clouds, Sina, Google or Microsoft jQuery, there is a great advantage:|
Many users access other sites, has grown from Baidu, they shoot clouds, Sina, Google or Microsoft load over jQuery. All of the results, when they visit your site, jQuery is loaded from the cache, thus reducing the load time. At the same time, most of the CDN can ensure that when a user requests a file thereto, will be away from the user's most recent response from the server, so you can also load faster.