jQuery: the king is dead

Believe it or not, I see new projects including jQuery in 2021, and, IMHO, it’s a shame. Here is a short post to explain why.

jQuery was the king

jQuery has been everywhere for quite a while, and there’s a good reason for that: it was handy, and it solved significant compatibility issues between browsers.

There was a time where people had to make websites for IE6 (Internet Explorer 6). It was an era of chaos ^^. Browser compatibility was a big part of the job.

I mean, there are still some minor incompatibilities, but now you can safely use helpful keywords such as querySelector that allow for quick DOM selections.

If you want to grab remote data, axios is your friend. Need some smooth animation? CSS3 animations rock.

Major frameworks and platforms run now without jQuery

See this PR. Bootstrap 5 won’t use jQuery anymore!

GitHub said bye-bye to jQuery some times ago too.

They used it, so there’s no doubt it was helpful. I’m not questioning that at all. May I add it was super dev-friendly? I mean the syntax and stuff.

However, we have much better tools now, and Vanilla js is an excellent choice in 2021.

You’ll be able to use most of the trendy js frameworks and, above all, understand how they work, what are their weaknesses and strengths.

Good reasons to keep using jQuery

Vanilla js equivalents

Here is a cool gist that shows it’s not so challenging to use vanilla js:

Wrap up

Please don’t waste your time learning jQuery in 2021 unless you need to handle a legacy project that still relies on that or if you have unusual constraints in your project.

Back in the days, it was a mistake to learn jQuery before JavaScript. It’s even more hazardous in 2021.

It’s best if you don’t start new projects with it.

As the world is not black and white, there can be specific cases where jQuery might fit your needs, but don’t use it only to make “quicker” DOM selections or essential operations. It’s a lot of bytes to load.