jQuery Installation
Add jQuery to Webpage :
It is very simple to include jQuery in your webpage. We can add jQuery to your webpage by simply adding single line of code. First of all we need to download the jQuery from the jQuery Site.
There are two versions of jQuery :
Production Version | Development Version |
It is Minified Version | It is Non-Minified Version |
It is Not Readable Version | It is Readable Version |
It is used on live website | It is used on website for testing purpose. |
Adding Downloaded jQuery :
After downloading jQuery, We can add it directly in webpage like below -
<head> <script src="jquery-1.10.2.min.js"></script> </head>
We can reference the jQuery file using the script tag in the head section of webpage.
Adding jQuery from Google/Microsoft CDN:
CDN is content delivery network. Let Google/Microsoft to host jQuery for you. So when your webpage is loaded then jQuery file will be loaded from the Google/Microsoft Server.
<head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/ 1.10.2/jquery.min.js"> </script> </head>
alternatly we can host jQuery on Microsoft Server as well -
<head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/ jquery-1.10.2.min.js"> </script> </head>
Advantages of Hosting jQuery on CDN :
When the user or client visits any website then visitor have already downloaded the jQuery from the Google. So while visiting your website, jQuery will be loaded from browser cache instead of Server which make site loading faster.