Should you learn jQuery in 2022?
Back in the day, Microsoft Internet Explorer was the most popular web browser. It was awful at following web standards. Often, you had to code everything twice: one for standard-compliant browsers, and another for IE.
Not only that, but it also was easier to use than the standard DOM. You could do with jQuery tasks that require complex logic if you used vanilla JS.
However, things have changed. Internet Explorer is no longer with us, and practically every browser follows the standards to the letter. Also, standards have improved and became simpler. And that brings the question: is it worth learning jQuery in 2022?
It's good to know jQuery and there are still use cases for it. However, you should not spend a lot of time learning it. jQuery should not be your focus this year.
The biggest advantage of jQuery now is that you can manipulate the DOM with less code. Yes, now the DOM has new features to make things easier, like
Yet still, the DOM is quite verbose. There are still quite a few tasks that require a lot of code if you want to go vanilla.
The thing is, if you are working on a small project, it's not worth adding an extra library. And if you have a big project with lots of DOM modifications, you'll probably need a UI framework like React, Vue.js, and friends.
If you do complex tasks and do the DOM changes yourself (either with jQuery or using vanilla JS), it can easily lead to unmaintainable code.
The big advantage of modern UI frameworks is that the framework itself takes the responsibility of changing the DOM, so you can focus on the business logic and declare how to display content on the page.
Also, jQuery isn't hard to learn. If one day you have to work on a project that uses it (and there are many of them out there), you can learn the library on the go. That's how I learned it 10 years ago! Just google a cheat sheet (I recommend this one) and you'll be fine.