If you don't want to download and store jQuery, you can also reference it via CDN (Content Distribution Network).
The servers of Baidu, Google and Microsoft all have jQuery.
jQuery Baidu cdn (you will definitely choose Baidu or Sina in China)
Loading address:
Uncompressed:
<script src="/jquery/2.0.0/"></script>
compression:
<script src="/jquery/2.0.0/"></script>
Supported versions: 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.2, 1.7.1, 1.7.0, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.6, 1.2.3
To quote jQuery from Google or Microsoft, use one of the following codes:
Google CDN:
Copy the codeThe code is as follows:
<head>
<script src="/ajax/libs/jquery/1.8.0/">
</script>
</head>
Copy the codeThe code is as follows:
/ajax/libs/jquery/1.10.2/
Try it yourself
hint: Get the latest available versions via Google CDN:
If you observe something on Google URL - jQuery version (1.8.0) is specified 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 (such as in this example 1.8), and Google will return the latest available version in the 1.8 series (1.8.0, 1.8.1, etc.), or you can only have the first number left, then Google will return the latest available version in the 1 series (from 1.1.0 to 1.10.2).
Microsoft CDN:
Copy the codeThe code is as follows:
<head>
<script src="/ajax/jQuery/jquery-1.8.">
</script>
</head>
Try it yourself
hint: Using Google or Microsoft's jQuery has a big advantage:
Many users have loaded jQuery from Google or Microsoft when visiting other sites. All the result is that jQuery is loaded from the cache when they visit your site, which reduces loading time. At the same time, most CDNs ensure that when a user requests a file from it, the response will be returned from the server closest to the user, which can also increase loading speed.
Several CDN acceleration points of jquery
Google jquery cdn acceleration point
/ajax/libs/jquery/1.10.2/
Microsoft jquery cdn acceleration point
/ajax/jQuery/jquery-1.10.
Sina jquery cdn acceleration point
/js/jquery/1.10.2/jquery-1.10.
You can also write this way, the first choice is, if the load fails, the second address will be loaded.
Copy the codeThe code is as follows:
<script type="text/javascript" src="/ajax/libs/jquery/1.10.2/"></script>
<script type="text/javascript">
! && ('<script src="/js/jquery/1.10.2/jquery-1.10."><\/script>');
</script>