How to use jQuery

If you want to use jQuery then firstly include it on the pages where you wish to take advantage of it. To do this you have to download the jQuery. You can download it from their website at After downloading the jQuery JavaScript file, you will have to reference it on your pages using the <script> HTML tag like this:

<script type="text/javascript" src="jquery-1.5.1.js"></script>
Now your page looks something like this:
<title>jquery test</title>  
<script type="text/javascript" src="jquery 1.5.1.js"></script>  
Instead of downloading and hosting jQuery yourself, there is a modern approach. You can include it from CDN (Content Delivery Network).
<script src=""></script>


<!DOCTYPE html>  
<script src=""></script>  
<h1> this is a heading</h1>  
<p>this is a paragraph</p>    
Try Now