Why jQuery is still relevant

Today, you might think that jQuery’s practices are old, outdated and ugly. Well, most likely you are right! But this does not mean that jQuery is no longer a relevant library to front end development. Despite its decline in terms of appeal, usage and popularity, jQuery is indeed still heavily used and might still be important in the next years.

… but why did jQuery decline in the first place?

The most important reason is that browsers are actually getting pretty good. The DOM’s API is one and its inconsistency across browsers has been the biggest obstacle to the development of web applications as we know them today: jQuery has helped us building applications better and faster by overcoming these problems. Nevertheless, nowadays we can finally say that consistency (still not being perfect) is way better than a few years ago. Or at least, better enough to ditch jQuery from our web apps.

Another important reason is the new generation of Javascript frameworks (React, Angular and Ember above all) that have promoted new and better ways in handling DOM manipulation, and especially the migration of the concept of plugin to the concept of component. Components are indeed an extensions of HTML: they are reusable data-driven elements, which, most times, auto-update themselves when data changes (2-way data-binding). In general, we are getting back to the giving HTML and markup in general more importance, rather than trying to have an extra-clean markup and try to solve all problems inside our Javascript code.

However….

jQuery is still extremely important. The first reason is that developers that need to make highly-compatible websites need jQuery. Unless you want to figure out by yourself how to fix all browsers’ ways of handling the DOM and different APIs, jQuery is your best shot to quickly build ultra-compatible websites. This situation is quite different for web apps, though, as you may (rightly) not want to support all the browsers out there.


Furthermore, jQuery is also used in a lot of modern frameworks: all Bootstrap’s Javascript is built on top of jQuery, Angular can integrate it for its directives, Backbone depends completely on it (and on Underscore), Ember depends on jQuery too, and Meteor JS also makes massive use of it.

I am pretty sure I am missing some other framework here, but these are probably the most famous ones.


Another important reason is the massive number of great jQuery plugins available out there. While the number of Angular and React components surely grows up day by day, the amount of jQuery plugins we can use is extremely high.

A common practice is to use jQuery plugins by wrapping them inside components and directives. Often, when we use my-angular-component.js, it is nothing else than a jQuery plugin wrapped inside a component to be used with some framework. And therefore, to use such plugins, you still need to include jQuery in your app.

jQuery is still relevant.

Maybe not for much longer, and this will depend heavily on how better the browsers will get, and also how modern framework will try to steer away from it, but today jQuery is still very important, and especially still extensively used.

I hear a lot of criticism against jQuery which I believe to be unfair: it is often erroneously compared to MVC frameworks when instead they try to solve different problems. And it is often criticised because of how easy is to abuse of the DOM thanks to it: it is true, but I’d honestly blame developers rather than the tool for this.

Is it that bad, after all? Well, no, it’s not: as long as it is used well, I think jQuery still is a valid way to build applications (see Quora). As long as plugins are self-contained, modular, and reusable, and maybe make use of client-side templating, it is likely sure that experienced developers can figure out the best way to architect an application based on solely jQuery.