If you do not want to download and store jQuery, you can also reference it through CDN.
Google and Microsoft servers both have jQuery.
To reference jQuery from Google or Microsoft, use one of the following code:
Google CDN:Copy codeThe Code is as follows: <Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
</Script>
</Head>
Try it yourself
Prompt: Get the latest available version through Google CDN:
If you look at the Google URL-jQuery version (1.8.0) is specified in the URL ). If you want to use jQuery of the latest version, you can also delete a number from the end of the version string (for example, 1.8 in this example, google will return the latest available versions (1.8.0, 1.8.1, and so on) in the 1.8 series, or only the first number is left, then Google will return the latest available versions in Series 1 (from 1.1.0 to 1.9.9 ).
Microsoft CDN:Copy codeThe Code is as follows: <Script src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js">
</Script>
</Head>
Try it yourself
Prompt: Using Google or Microsoft's jQuery has a great advantage:
Many users have loaded jQuery from Google or Microsoft when visiting other sites. All the results are that jQuery is loaded from the cache when they visit your site, which can reduce the loading time. At the same time, most cdns can ensure that when users request files from them, they will return a response from the server closest to the user, which can also increase the loading speed.