jQuery – The most used JavaScript Framework

ipivanov No Comments JavaScript 61

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.

The set of tools used to allow modification and control of the DOM are a bit of mess because they differ across browsers, generally for historical reasons. To make your job easier, a number of libraries have been created that hide these differences, providing a more uniform way of interacting with the DOM. Often they also provide AJAX functionality, taking the burden of that complexity away from you.

jQuery is far and away the most popular DOM library and it is used on a huge number of websites.

jQuery has a very distinctive syntax, all based around the dollar symbol. Here’s some:


$('.btn').click(function () {
    // do something
});

This code attaches a click handler to all elements with a class of btn. This selector syntax is core to jQuery.

jQuery is added to a page by simply including it as a file using a script element. Download it from jquery.com, or include it from a Content Delivery Network (CDN) such as CDNJS:


<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

In the following pages we’ll be taking a look at jQuery for selecting and manipulating elements, AJAX and at some of its other useful tricks.

Leave a Reply Text

Leave a Reply