loading...
Cover image for Do we still need jQuery in 2020?

Do we still need jQuery in 2020?

mouadkh9 profile image Mouad Khchich ・2 min read

Last week, Bootstrap launched their latest version (v5 alpha) and one of the new features was that they no longer depend on jQuery, that got me thinking, do we actually need JQuery in 2020?

jQuery is one of the most popular libraries in the world, so popular that it’s used by 75.9% of all the websites. In this article we’ll talk about how it became so widely used, and if it’s still worth learning in 2020.

Why is jQuery so popular?

JQuery was created in 2006, back when Internet Explorer was the most used browser and the web was totally different place than it is now. It solved a lot of problems for front-end developers back then; it provided a simple and clear API to build websites with ease. For example:

  • DOM manipulation: Using CSS selectors and some functions you can traverse and manipulate the DOM so easily compared to the vanilla Javascript approach.
  • Animations: JQuery provides some easy to use out-of-the-box functions for animating DOM elements, without needing to get messy with CSS.
  • AJAX: Making AJAX requests without jQuery was a hassle, but with JQuery you can do it in a couple of lines.
  • Cross-browser compatibility: JQuery provides an API that can work on most browsers, something that's very hard to achieve if you're using javascript, this saved developers a lot of problems.

Is it still worth learning in 2020?

The short answer is no, here's why:

Better alternatives:

Javascript has matured so much during these last years, it supports a lot of new APIs and its community has built so many great libraries to fill any void jQuery might leave. "You might not need JQuery" is a website that states alternatives for (almost) every JQuery feature, for example, let's say you want to add a class to a certain element:

// Solution in jQuery
$(el).addClass("className");
// What you need to do in pure JS:
el.classList.add("className");

So as you can see, jQuery is more replaceable than we used to believe, especially with the emergence of front-end frameworks like React and Vue.

PS: Mixing two frameworks like React and JQuery is a very bad idea.

Size matters

Amazon famously found that every 100ms of delay in the load time of amazon.com cost them 1% in sales.
So loading an 80KB JQuery is a big problem, a problem we can avoid if we can find lighter alternatives.

Conclusion:

To summarize, I think the web right now is passed JQuery, we have better, and lighter tools at our disposal. But as a web developer, it's sometimes still required to use JQuery because as I've mentioned before, it's widely used, so you might run into situations where you have to use it, in such a case, you can just refer to their documentation and you won't have a problem because you'll be so well versed in javascript by that point.

Posted on by:

mouadkh9 profile

Mouad Khchich

@mouadkh9

An amibitious young web developer, sharing my journey and knowledge in the field for web/mobile development.

Discussion

markdown guide
 

Good article, I think it still a good idea to learn jquery, you gonna have to deal with it sooner or later, so it makes sense to at least have a little bit of knowledge about it, but I agree that there isn't must use for it and we have better alternatives.

 

When we teach JavaScript, we build a little jQuery clone - so, that they'll understand the idea and reasons it was created - and then can easily use it on legacy projects.

 

That's some very good practice, two birds one stone!

 

True, you will run into it eventually, that's why I appreciate their documentation, it's really clear and straightforward.

 

Amazing article! 👏 👏 👏
jQuery was an awesome library at a time. I used to design most of my projects with the help of jQuery and a bunch of $ there. I recently gave up with jQuery as vanilla JS can do almost anything we want jQuery to do. 🥳

jQuery is a well written library but heavy, because it has a number of polyfills added to support old browsers. I was using it on my website for animations but it took me 3 seconds of load time to make my site clickable on every visit and I'm leaving jQ for these reasons.

You might not need jQuery is great collection of js techniques. 😀 Thanks for sharing. I hope you'll be back soon with more awesome posts. 🥰

 

Thank you! I really appreciate the feedback.
You made some very good points about loading time, and jQuery is definitely not worth it.

 

There is a lot of sites and even older CMSs that use it or depend on it for frontend stuff. So it will continue to be implemented or at least need to know how to deal with it so knowledge of it is not wasted but perhaps a new project with newer frameworks probably does not have any need for it.

 

Yes, it will always come in handy but a common mistake ( Did it too 🤷‍♂️) is learning it before learning the same things in JS.

 

Nice article! I love jQuery but I see it the same way. :)

I wrote an article on my blog about how to move from jQuery to pure JavaScript and about other advantages like speed performance for SEO, a practical example and a list of 1:1 translations.

If you're interested, check it out: webdeasy.de/en/jquery-to-javascript/

 

Totally right. But few legacy applications still use jquery. Also WordPress uses JQuery a lot. Myself was working in WordPress few months back and used jquery.

It's also used for small animations in static sites. But recent css and js tweaks are lowering this probability also.

 

Yes, unfortunately, but WordPress without jQuery would be a mess! So let's stick with JQuery there 😂

 

There are also some fun little stripped down versions of the idea like: github.com/fabiospampinato/cash is you're company really wants to have a few of the conveniences.

 

That seems very promising! I'll definitely give it a try.

 

The odd thing about JQuery, is that in 2020 it's still used more than Angular and React. However, as the article mentioned, it's days are numbered. Just think, in the next epidemic they'll be looking for JQuery people instead of COBOL programmers.

 

jQuery is only relevant if you are working on an old legacy codebase. New projects should be using modern javascript frameworks. It's interesting though because I recently had a recruiter show me a job specification that had WordPress, PHP and jQuery. So I suppose if you are still using that technical stack it might be relevant but not to me 😅

 

Here's the first thing I searched for in that "You Might Not Need jQuery" site:

Each

I'll stick with jQuery a bit longer.

 

You might not need to. The image you pointed is not that relevant any more.
IE9 market share is 0.6% IE11 is 1.3% you're speaking about dead browsers whose use is mostly recorded by developers testing and still supporting those.

Therefore we can calmly finally call it a decade and build for modern browsers. And since NodeList has the prototype forEach...

document.querySelectorAll(selector).forEach(el => {

});

Or use function instead of the => Arrow Function syntax to support IE11

 

Yeah, I was thinking about this afterward - actually I've been using Typescript lately and syntax and language features aren't even an issue, since I can downconvert it to ES5 anyway. And I think querySelectorAll has been around even in IE9, so I can use that safely.

I like jQuery's AJAX syntax, but I usually write an AJAX wrapper anyway, so I suppose that's not an issue.

I suppose my fingers are just used to typing jQuery all the time that it would take awhile to teach them to type something else.

 

Nice article 😃

I wonder if a similar fate awaits d3.js? Are there any alternatives or does it still own that niche.

 

I still can't find the alternative that could surpass d3.js network/graph UI ...

 

I really don't know since I don't use d3.js much, but I think it will lead that field for years, it seems like it at least.

 

I've made alot of money for having the legacy skills like jquery or even dojo. There alot of clients, mostly banks running on that stack..

 

Good point, but you can make a lot of money working for clients using the newest stacks. And why not even both?

 

Sure.. I love the newest stuff more

 

You're going to need to learn it sooner or later as you can start working on a project that's using it. Can you avoid writing jQuery for the new code? Sure, but it has to be compatible with the browsers the project works on.

For sure, if a company is going to start a new project it can decide to use jQuery's alternatives.

 

Exactly, but due to its former popularity, it will always be used for maintenance.

 

I haven't used jQuery in ages. For the few times where the JavaScript is cumbersome I write quick wrappers.

I try to avoid frameworks like bootstrap as well now. Too much for too little.

 

Wise choice! Most of what I said applies to Bootstrap too to some extent.

 

WordPress depends heavily on it too. I work primarily with WordPress, so I can't seem to escape. 😅

 

Yes, unfortunately, JQuery will always be used for maintenance.

 

Love the Amazon reference.
Nice article.

 

Thank you! It's interesting to see real-world consequences of technical decisions.

 
 

Depends upon the case use. If I am using some jquery plugins then jquery is needed. Mostly in my personal projects I tend to use it as a last resort.