How to Install jQuery

There are two ways to use jQuery, either downloaded locally or on a Content Delivery Network (CDN). The local copy is just that, a file that sits within your document root on your server's hard drive. A CDN-hosted version means that the jQuery file sits on someone else's server and you just reference it in your code.

Whether you use a local copy of a CDN is up to you. For production websites, use a local copy of jQuery for speed and reliability. However, in development, it's okay to use the CDN version of jQuery.

Install jQuery locally

jQuery is available as a download. Once there, select the Production version and click Download. Depending on your browser's settings you may end up with a page full of JavaScript code. If that's the case, select Save As from the File menu.

In other cases, you'll simply be prompted to download a file. In the end, you want to end up with a file named like jquery-1.8.1.min.js, regardless of whether you save the file or download it.

The file should be placed into your document root. Remember the filename; you'll need it later.

That's all there is to installing jQuery — download it and put the file into your document root.

Use CDN-hosted jQuery

The CDN-hosted option for jQuery is great for development. You don't have to worry about downloading the file or putting it in the right place; it's always available (as long as the CDN is up). CDN-hosted versions are available from many of the big-time players on the web, like Google and Microsoft.

You don't need to download anything in order to use a CDN-hosted jQuery, so this section is short and sweet. You can find the links for the CDN-hosted versions at www.jquery.com/download.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.