SIGN UP MEMBER LOGIN:    
ARTICLE

Introduction of JQuery

Posted by Abhishek Bhat Articles | JQuery September 07, 2011
JQuery is a Javascript library which is used extensively for client side validation and manipulation of Dom elements.
Reader Level:

JQuery is a Javascript library which is used extensively for client side validation and manipulation of Dom elements. It is a light weight, cross browser compatible and is a repository of many reusable Javascript functions. To learn JQuery, we should have awareness of Html, CSS and Javascript.

The jQuery library contains the following features:

  • HTML element selections and manipulations
  • CSS manipulation
  • HTML event functions
  • JavaScript Effects and animations
  • HTML DOM traversal and modification
  • AJAX
Adding JQuery to a page :

The jQuery library is stored as a single JavaScript file, containing all the jQuery methods.

It can be added to a web page with the following mark-up:

<head>
<script type="text/javascript" src="jquery.js"></script>
</head>

Please note that the <script> tag should be inside the page's <head> section.

jQuery syntax :

Basic syntax is: $(selector).action()
  • A dollar sign to define jQuery
  • A (selector) to "query (or find)" HTML elements
  • A jQuery action() to be performed on the element(s)
Examples:

$(this).hide() - hides current element
$("p").hide() - hides all paragraphs
$("p.test").hide() - hides all paragraphs with class="test"
$("#test").hide() - hides the element with id="test"
$("p").css("background-color","yellow");

jQuery Events

Here are some examples of event methods in jQuery:

$(document).ready(function) Binds a function to the ready event of a document
(when the document is finished loading)
$(selector).click(function) Triggers, or binds a function to the click event of selected elements
$(selector).dblclick(function) Triggers, or binds a function to the double click event of selected elements
$(selector).focus(function) Triggers, or binds a function to the focus event of selected elements
$(selector).mouseover(function) Triggers, or binds a function to the mouseover event of selected

JQuery updates and downloads :

jQuery.com has all the updates. JQuery is available in two flavors Minified (for production) and Uncompressed (for development and testing). Current version of JQuery is 1.6.2. We can download JQuery file and place it on our application folder and just mark a reference to JQuery file within the html file to make it work.
 
If you don't want to download JQuery, you can directly use hosted JQuery library from Google or Microsoft CDN.

Login to add your contents and source code to this article
share this article :
post comment
 

Thank you for this simple explanation of JQuery. As a self taught web developer, I have been using Jquery plugins, but often have desired to modify small things about the plug in itself. By their nature, most of the plugins are licensed under a GPL, allowing me to do just that, but I don't understand a lot about the actual code that makes the plugins work. This is a good explanation that points me in the right direction. Thanks, Chad

Posted by Chad Musgrove Sep 07, 2011
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Team Foundation Server Hosting
Become a Sponsor