Select Chapter ❯
jQuery Tutorial
- jQuery Introduction
- jQuery Selector
- jQuery Traversing
- jQuery Events
- jQuery Get/Set
- jQuery Add/Remove
- jQuery CSS
jQuery Effects
jQuery Ajax
jQuery Introduction
jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
jQuery Installation
It two very simple steps:
- Download jQuery from the download page and get the latest version of it.
- Now put the jQuery in your website directory
jQuery Usage
Now link the jQuery in your webpage:
<head> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> </head>
Example of jQuery
<html> <head> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function(){ $("p").click(function(){ alert("Hello"); }); }); </script> </head> <body> <p>Click Me</p> </body> </html>
You can also use jQuery in seperate file with .js extension.
$(document).ready(function(){ $("p").click(function(){ alert("Hello"); }); });
Save the file with filename.js and add the link in your webpage.
jQuery Syntax
$(selector).action()$("p").click() $("#demo").hide()
- A $ sign to define/access jQuery
- A (selector) to "query (or find)" HTML elements
- A jQuery action() to be performed on the element(s)