Today it is a widespread custom to kick into jQuery and every project where it is present. We like to criticize, which is not necessarily a problem. Although I think it is worth checking out today’s jQuery to see the bigger picture.
It Is Always Come Up
Last week, the newest White House’s (Biden era) site came out (I like this site). It is using WordPress and jQuery. The last one bothered some the first one less.
Why should a website in 2021 use jQuery? Well, it is a good question. We can’t see the developer choices from here, but there is a possibility because it uses WordPress, there are a few dependencies that rely on it.
When I (and You Should) use jQuery?
I work with WordPress a lot. It is a monolith. Sometimes I like it more and sometimes less. I think it is a good option if you need a CMS.
Unfortunately, many WordPress plugins rely on jQuery (in my case, it is mostly Contact Form 7). When it comes to WP the things are changing slowly. It is clear that many developers want to drop jQuery here, too, but it is not that easy.
If I use WordPress, I usually have to load jQuery somewhere, so if I can, I use it, and I don’t feel any shame.
Do We Need It Today?
From the previous section, you can guess my opinion here. We don’t need it unless there is an unavoidable dependency that needs it. And if it is present, you can actually use it.
It has cool features and a simple API. jQuery is a well-known old friend who doesn’t let you down (unless with its size :().
Yes, There Are Better Tools
Today we can choose from the innumerable JS frameworks like Vue.js, React, Angular, Svelte. These are more modern and complex systems than jQuery, but the goal is still the same; to help the developer.
We Don’t Know That Much
Everything has its pitfalls, and everything can be deprecated but still useful for someone. Every tool has its place to use. For example, we use infinite numbers of CSS grids (in the form of a framework) in our projects but for what reason? We can choose CSS Grid and build better stuff with less code, and still, we are stuck with the Bootstrap grid. It is a choice that was made at some point. We should handle it in place and switch it if and when possible.
I think if you can, you should avoid jQuery. If you manage a legacy project, you should always try to upgrade to the latest version. If it is present, you can use it and don’t feel any shame.