How to Add Jquery to Web Pages?

Note: Demo and source code of current tutorial is available in bottom. Our last tutorial was about Hide/ Show Element on Double Click Using Jquery for any one interested.

There are two ways you can add Jquery to your webpage:

  1. You can download Jquery library from Jquery website jqurery.com
  2. You can use CDN to include Jquery like Google

You can download two available versions of Jquery:

  1. Production version which can be used for your live websites.
  2. Development version which can be used for test development.

You can easily download both versions of Jquery from Jquery website jquery.com. On the other hand you can use HTML tag <script> to to link jquery library. Jquery library is basically a single Javascript file. Remember you will place <script></script> tags between <head></head> tags to include Javascript file.

Sample of code how to link Jquery javascript file in web page is below:

<head>
<script src=”jquery-1.10.2.min.js”></script>
</head>

You can see we have not used type=”text/javascript” inside <script> tag since it is not required in HTML5 and yes Javascript is default scripting language in HTML5 and in all modern browsers.

You can also include Jquery library using CDN like Google. CDN stands for content delivery network. You can get it from Google and Microsoft because both of these companies host Jquery. Sample of code how to connect with CDN is given below:

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

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

Share This Post

Related Articles

Leave a Reply

You must be Logged in to post comment.

© 2014
Tutorials By: Muhammad Junaid Iqbal