jQuery is a fast, small, and feature-rich JavaScript library. It simplifies HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax. It is written in and for JavaScript and designed for web front-end applications only.
It is a lightweight library (30kb minified and gzipped) that supports accessing web elements via CSS3 selectors. (So if you know CSS, it really helps, but isn’t completely necessary.) It is also very cross browser compliant.
You can get a copy of jQuery at: https://jquery.com/
Why Use jQuery
jQuery provides an easy-to-use API that works across a multitude of browsers. This makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler.
jQuery stakes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. This means that development time for developers is a lot smaller, because what might take 1, 2, 4, or more lines of code could be written in a single line. Developers also know that jQuery code is well tested, so their testing didn’t take as long.
jQuery was expanded, and had secondary libraries, such as jQuery UI and jQuery Mobile which used jQuery to provide additional functionality. jQuery UI was used to help build interfaces, adding features before they were standard, such as calendars for picking a date or date range, and many more. jQuery Mobile, was designed to make your web applications look more like a mobile application, include page flip animations and more.
It is free, open-source software using the permissive MIT License.
Extensibility
jQuery is very extensible in that not only is it open-source, but you can also create your own plugins to utilize jQuery, but then add to it.
There are many official plugins listed on jQuery’s website. And you can often find others not listed on the site. I’ve personally created several plugins which are not on the jQuery site for one reason or another.
Disadvantages of jQuery
One of the main disadvantages is the size of the library. jQuery is a single JS file that contains all its DOM, events, effects, and AJAX components. Over time, with each new version, the file has gained a significant amount of kilobytes. This can result in slower page load times and increased bandwidth usage. They minimized this some when they dropped support for older versions of Internet Explorer, but it is still large.
Another disadvantage is that jQuery can create a crutch for developers. Its abstraction hides the “ugly parts” of JavaScript DOM manipulation. This can make it more difficult to learn JavaScript. This can result in developers who can do simple tasks like rollovers and slideshows but run into problems when real DOM manipulation comes into play.
Additionally, there have been many versions of jQuery published in a short time. While each new version adds functionality and or fixes bugs, this also means that they have to keep up with the versions and test for compatibility issues.
Should I Still Use JQuery?
When jQuery came out, each browser had its own way of accessing different elements in the DOM, so jQuery was really helpful in simplifying that task.
However, with the consolidation of browsers, and different browsers becoming more standards compliant, some people have asked “is jQuery still relevant?”
This is a good question to ask. To stay relevant, jQuery has dropped support of older IE versions, which allowed it to shed a lot of its (download) weight, yet it still seems large, especially for simple projects.
Does it make it faster to code? yes – but how many people will use it?
Should it be relegated to smaller projects, and prototyping? This is the question that many are asking. The same people who loved it at one time, now often hate it:
What’s Next?
jQuery 4 is getting ready for release, so it is still an active project in development. That’s the good news.
jQuery had two related projects, jQueryUI and jQuery Mobile, for developing User Interfaces and Mobile Friendly Apps respectively. However, they are in maintenance mode (security types of updates) and deprecated (no longer supported) respectively now, since more browsers on mobile devices are better suited to be used with HTML5 and CSS3.
No longer supporting a project isn’t a bad thing. It allows you to focus on what you need, and it shows that you are growing with the rest of the web ecosystem.
What is jQuery was originally found on Access 2 Learn