var $ = document.querySelectorAll;
Now you can select element like in jQuery.
The problem I have with jQuery is that it makes beginners use technology that they don’t know how it works behind.
If you want to grow in a great developer and maybe some day build your own framework or library you need to know how DOM, HTTP Requests, effects and other things really works.
Why is jQuery becoming less popular?
- Browsers have mostly moved past their previous big inconsistencies.
- You might find jQuery is a big file to add to your website if you just need to do thing.
- For small sites, jQuery is fine, but for bigger, more complicated apps, where you will be writing a lot of code, it lacks a guiding structure. This could result in “spaghetti code”. The prevailing practice of the day is to build your web app with smaller, self-contained components rather than one monolithic wall of code.
- Along with components, newer frameworks (React, Vue) are pushing “reactive” models of app design, where the framework updates your DOM automatically if the data changes. While you could build your own reactive system using jQuery, people tend to use it for “event-driven/imperative” design: i.e. “when the user clicks this, app do this.” Reactive design encourages programmers to write “declaratively,” i.e. “the data should display this way; the user clicks this, and the data updates.” The former (imperative), requires the code to think of all the possibilities, and results in more code. Declarative programming tends to result in simpler, cleaner code.
As to valid reasons one might dislike jQuery, it’s slow. For most uses this slowness is a non-issue, but once your app becomes more complicated and performance becomes an issue, jQuery may be part of the problem.
On a side note if you just want the selection engine features of jQuery (ie you won’t be using any jQuery plugins) another option is D3. The newest version of D3 is modular and you use only the parts you need while not having to include the full library. I do a lot of data visualization so I’m already using D3 is most projects, and I usually don’t need to bring in jQuery on top of it.
I guess the whole thing is perspective.
There will never be a lightbulb moment (an ah-ha I get it moment, with this discipline.
Its more like a dimmers witch (gradually over time you’ll be able to see and understand more and more).
Just keep slowly coming back, and hitting it again and again, over and over… go to multiple sources also… many books and many videos.
Remember… its yours if you want it.
Most older projects and experienced developers will use it, and you shouldn’t break from their convention based solely on preference. Overall I would say it’s very much worth learning both.