Click here to Skip to main content
13,045,790 members (47,113 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 11 Oct 2013


, 11 Oct 2013
Rate this:
Please Sign up or sign in to vote.
What is jQuery?jQuery is a light weight javascript library which provides fast and easy way of HTML DOM traversing and manipulation, event handling,

Editorial Note

This articles was originally at but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

What is jQuery?

jQuery is a light weight javascript library which provides fast and easy way of HTML DOM traversing and manipulation, event handling, client side animations, etc. One of the greatest features of jQuery is, it supports an efficient way to implement AJAX applications because of its light weight nature. According to the jQuery official site, “jQuery is designed to change the way that you write JavaScript.”

Jquery basic example:
    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript">
    <a href="">jQuery</a>

What is dollar sign($)?

In jQuery, the most powerful character / symbol is the dollar sign. A $() function normally returns a set of objects followed by a chain of operations. An example
view sourceprint?
1.$("div.test").add("p.quote").html("a little test").fadeOut();

Think of it as a long sentence with punctuations. Indeed it is a chain of instructions to tell the browser to do the following:

   1. Get a div with class name is test;
   2. Insert a paragraph with class name is quote;
   3. Add a little text to the paragraph;
   4. Operate on the DIV using a predefined method called fadeout.


The most commonly used command in jQuery is Document.Ready(). It makes sure code is executed only when a page is fully loaded. We often place code blocks inside this Document.Ready() event. For example:

      alert("I am ready!");

More example to understand

jQuery has a simple statement that checks the document and waits until it's ready to be manipulated, known as the ready event:

   // Your code here

Inside the ready event, add a click handler to the link:

     alert("Thanks for visiting!");

Save your HTML file and reload the test page in your browser. Clicking the link on the page should make a browser's alert pop-up, before leaving to go to the main jQuery page.

For click and most other events, you can prevent the default behaviour - here, following the link to - by calling event.preventDefault() in the event handler:

     alert("As you can see, the link no longer took you to");

Where to find more information?

Start out by checking the official site:


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

ASP.NET Community
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
Group type: Collaborative Group

765 members

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Brian A Stephens14-Oct-13 5:10
professionalBrian A Stephens14-Oct-13 5:10 
BugThere are more problems than useful information Pin
Brian A Stephens14-Oct-13 5:08
professionalBrian A Stephens14-Oct-13 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 11 Oct 2013
Article Copyright 2013 by ASP.NET Community
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid