To web developers, jQuery is considered as a fascinating JavaScript library that helps doing whatever they want with HTML elements.
What is jQuery?
According to the main page of jQuery library, I want to quote its original definition:
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. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
jQuery was designed with the perception of “Write Less, Do More” enabling to work HTML elements in a simpler way than the traditional JavaScript codes. It is actually called JavaScript based library rather scripting language.
Let’s give a basic example, “Hello World!” a common toy program in both JavaScript and jQuery to see differences in writing tasks. Suppose to have an HTML element having the identifier as demo.
document.getElementById("demo").innerHTML = "Hello, World!";
$("#demo").html("Hello, World!");
This short example shows how jQuery can achieve the same end result as plain JavaScript in a concise manner.