DEV Community

Cover image for Do we still need jQuery in 2020?

Do we still need jQuery in 2020?

Mouad K. on July 31, 2020

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 thi...
Collapse
 
____marcell profile image
Marcell Cruz

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.

Collapse
 
perpetual_education profile image
perpetual . education

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.

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
rokobuljan profile image
Roko C. Buljan

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 => {

});
Enter fullscreen mode Exit fullscreen mode

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

Collapse
 
jessren profile image
JessRen

Yeeees. Thanks for highlighting. That thesaurus is clunky.

Collapse
 
giorgosk profile image
Giorgos Kontopoulos 👀

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.

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
webdeasy profile image
webdeasy.de

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/

Collapse
 
dumdum profile image
dum dum

jQuery is still useful when you develop web app using Django for simplicity.
Because React + Django would add more complexity and remove advantages from built in Django features in Django Templating.

It's my personal opinion.

Collapse
 
mouadkh9 profile image
Mouad K.

That's true for most templating frameworks ( Blade for laravel for example ), but currently, you can ditch jQuery for vanilla JS.

Collapse
 
vishesh profile image
Vishesh

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.

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
pris_stratton profile image
pris stratton

Nice article 😃

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

Collapse
 
dendihandian profile image
Dendi Handian • Edited

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

Collapse
 
mouadkh9 profile image
Mouad K.

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.

Collapse
 
alphavader profile image
KB

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..

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
alphavader profile image
KB

Sure.. I love the newest stuff more

Collapse
 
agrogers profile image
Andrew Rogers

Hi. I don't understand the 'jquery file size is too big' argument. It's only 80k and may already be cached. Pretty much every site will have some images on and just a couple of them are likely to be bigger than 80k. The front page of amazon might have 100 images on it. Is this just an old argument that is not really relevant anymore?

Collapse
 
perpetual_education profile image
perpetual . education

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.

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
jwp profile image
John Peters • Edited

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.

Collapse
 
andrewbaisden profile image
Andrew Baisden

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 😅

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

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.

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
n8chz profile image
Lorraine Lee

I can't imagine living without jQuery, but I use it for content scripts in browser extensions. I see no reason to use it for web development (and never did). In content scripts I use it mainly to undo the (nefarious) work of others; to reverse engineer deliberately convoluted class name schemata, for example.

Collapse
 
mohsenalyafei profile image
Mohsen Alyafei

thanks. good article.

Collapse
 
jsn1nj4 profile image
Elliot Derhay

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

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
keno_sej profile image
Kenan Sejmenović

Love the Amazon reference.
Nice article.

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
mouadkh9 profile image
Mouad K.

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

Collapse
 
hassam7 profile image
Hassam Ali

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.

Collapse
 
bigbott profile image
bigbott

If your site requires indexing by search engines SPA is not a solution.
Old style multiple pages website featured by jQuery will do much better.

Collapse
 
bigbott profile image
bigbott • Edited
  1. "jQuery is used in 75% of the sites".
  2. "Is it still worth learning? - No"

Summary: Author is an .... (put your nicer word here)

Collapse
 
bigbott profile image
bigbott

If size matters for you so badly, you should avoid React in the first place.
And jQuery only 27kb gzipped.

Collapse
 
thyuck profile image
raldskie 🔥

Idk why I find JQuery's syntax clean and compact than the Vanilla JS.

Collapse
 
bryku profile image
bryku

In a strange way Jquery can sometimes reduce code as well... for extremely large projects that is.

$('#nav').addClass('hide'); vs document.querySelector('#nav').classList.add('hide')

It is almost half the size... I mean it would take a lot of code IIRC its 90kb, but if you have a huge single page project in the long run you could end up saving.

Jquery covers a lot of things and a lot of backward compatibilities. If they went through it and removed all the backwards compatibility bs they could probably shop it down to 40kb easily.

For example I wrote my own mini jquery clone. It only has a few things, but they are what I used jquery for the most.

example: .html() .addClass() .toggledClass() .addClass() and a few others, but its 1.6kb and it handles all the matches as well. $('#items li').

I've also seen a pretty big project where they just dedicated a shorthand for 'document.querySelectorAll()'. which was '__()'.

The literal code was var __ = (s) => {return document.querySelector(s)}

I guess I rarely use libraries if I don't have to. If it is something small there is no point and if it is really big then you are probably using something else (view, react or whatever).