Essence, Usage and Advantages of jQuery

Essence, Usage and Advantages of jQuery

#jQuery is a #JavaScript library which essentially provides a wrapper. It basically exposes API's which can be called to perform incredible tasks in the UI. With the help of jQuery, the following can be achieved in a seamless manner:

1) Manipulating DOM elements
2) Creating #HTML on the fly
3) Binding events and triggering them using code
4) Sending ajax requests to the server.

jQuery is a platform which encourages the developer to write less lines of JavaScript code and concentrate on the high level functionalities that need to be achieved. It also ensures that the code is cross browser compliant.

There are two ways in which jQuery can be started on website:

1) Downloading the jQuery library from
2) Including jQuery from a CDN.

The jQuery library comprises of a single #JavaScript file and it can be included in the following manner:-

Selectors: jQuery selectors are the most essential in jQuery. They are used to find elements on the basis of their id, class, tagname etc. All the selectors start with a dollar sign. Given below are a few selectors:

1) The #id selector: It uses the id attribute to select an HTML element. eg., $("#id")
2) The.class selector: It finds the element with a specified CSS class. eg., $(".class")
3) The tag selector: It finds all the elements having a specified tag eg., $("a") finds all anchor tags.

Functions: There are several functions or API's which provide exciting features. A few of them are as follows:

1) hide() - hides an element
2) show() - shows an element
3) HTML() - sets the HTML of an element
4) append() - appends HTML at the end of an element
5) prepend() - inserts HTML at the beginning of an element

Event Binding and triggering: jQuery can be used to bind events to HTML elements and also to trigger those events.

A click event can be bound to a button using $("button").bind("click",handler) where "handler" is a function that needs to be invoked on the click of the respective button. The click event can be triggered using the following code snippet: $("button").trigger("click").

Ajax Requests: Ajax requests can be sent using #jQuery which would perform a POST or GET request to the server and in turn fetch data from the server.

Plugins: The #jQuery # community also has several #plugins that works as a reusable component that can be used on websites. Few of those are:

1) UI dialog
2) Accordion
3) Tabs
4) Autocomplete

Views: 169
Author: Regular Articles
The author of this article has over 6 years of experience in Website development Company Website Development Services and Mobile Application Development using technologies such as C#, Asp.Net, SQL Server, HTML, jQuery. He also has rich experience in jQuery having developed applications which have a rich blend of Asp.Net and jQuery.
Tell a friend
Average rating:
(0 votes)

Hezbollah buries militant Qantar, says Israel will be held accountable

Lebanon's Hezbollah group said on Monday that Israel would be held accountable for killing prominent militant Samir Qantar in an air strike in Syria, and accorded him an elaborate funeral of... Read More

Russia says black box from warplane downed by Turkey unreadable

Investigators in Moscow said on Monday they were unable to retrieve information from the damaged black box of a Russian warplane shot down by Turkey last month, data the Kremlin hoped would support... Read More

Exclusive: U.S. glossed over Oman's human rights record during Iran talks

By Jason Szep, Matt Spetalnick and Yara Bayoumy WASHINGTON/MUSCAT (Reuters) - As the United States negotiated this year’s nuclear pact with Iran, the State Department quietly agreed to spare the... Read More