jQuery Install

JQuery Install

To add jQuery to a Web Page

A developer has to follow some steps to add jQuery to a webpage and the basic steps are provided below:

  1. First the developer needs to download the jQuery library and the developer needs to do so from the jQuery.com.
  2. The developer needs to include jQuery from a CDN and one of the examples of the CDN is Google.

To download jQuery

The developer has an option to download one of the two versions of the jQuery.

  1. The developer can choose to download the production version of JQuery. This version is suitable for the developers who has a live website and the main reason behind that is it is minified and compressed.
  2. Another version is the development version and it is suitable for testing and development. The reason behind it being suitable for testing and development is that it is uncompressed and the codes are readable.  
  3. The versions can be downloaded from jQuery.com.  
  4. As the jQuery library is a single JavaScript file its referencing is needs to be done with the HTML <script> tag.
  5.  

 

  • One hint: The downloaded file should be placed in the same directory as the pages where the developer needs that to use it.
One of its example is provided below:
<head>
    <script src=”jquery-1.11.1.min.js”></script>
</head>

 

jQuery CDN 

If the developer chooses not to download and host the jQuery then the developer can a different thing and that is to include it from a CDN which stands for Content Delivery Network. The mighty Google and Microsoft have one thing in common and hat is they both host jQuery. The process to use jQuery from Google and Microsoft varies though.  

Google CDN

<head>
    <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script>
</head> 

Microsoft CDN

<head>
    <script src=”http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js”></script>
</head>