I get asked alot of questions about jQuery. And most are pretty valid for a curious mind learning to code. A few popular ones are the following:
1. Should I learn jQuery?
2. What's the benefit?
3. Is it still popular?
4. Will it make me amazing?
And the answers are varied, but essentially, you should use jQuery for a number of reasons which I will detail down below. And perhaps a few reasons why maybe you shouldn't use it. But at the end of the day, using jQuery is akin to going to a restaurant instead of making your own dinner. Sure, you pay a little more but you end up with the same ingredients (though maybe more calories) and you bypassed the messiness of having to clean up the kitchen.
And it kind of looks like this:
jQuery did not appear from the ether. It was built by John Resig, a software developer from Boston. Go Red Sox. Here is John's LinkedIn for your cyber-stalking pleasure if you so wish.
Since it's inception jQuery has been used in millions of websites around the world. According to buildwith.com, the number is estimated to be the following.
That's a fair marketshare, to say the least. Much of that has to do with the fact that it has been around since 2006, during a time where there weren't many options really.
"Continue" to use it?
Alright, first off, if you are working on a website or project that is using jQuery, don't remove jQuery. Unless you want to spend the next few months replacing every $and every jQuery function to some other equivalent.
I would also recommend not transitioning out of using jQuery either for an alternative framework. Not only can it cause cross-framework problems on some deep unseen level that will spring up at the most inopportune time, but you can cause performance issues and confusion in the long term. And confusion among programmers is a huge reason for many of today's biggest coding blunders.
And as stated earlier, there are also an approximate 60+ million websites using it, which means that it will probably be supported for a good number of years. And this is one of it's main strong suits. It has longevity, which means that many of the bugs that were prevalent during its early years are now long gone. It's not perfect, by no means. You can view the list of open bugs and see for yourself. But maintenance is ongoing and improvements are being made constantly.
It has also gotten more efficient as far as performance goes in terms of its animation capabilities. So you can spend more time designing, engineering and architecting and less time worrying about frames, sprites and GPU spikes.
jQuery does not have much competition. There are alternatives, sure. If you Google around a bit, you can see a few popular names here and there, such as Cash or UmbrellaJS. These claim to be the better solution to jQuery because of their smaller filesize and footprint, but their syntax is still similar to jQuery in many ways and their usage is of course not on par with jQuery.
UmbrellaJS for example has the following usage metrics:
You can compare that to jQuery:
And the similar case is true for many other current frameworks that are aiming to take on the giant.
I'll say this, there is a space for these frameworks in the future, but it won't be due to their filesize. That's a very shortsighted way of looking at technology. Each day we jump leaps and bounds in terms of storage capabilities and network bandwidth. An 8kb file is not better than a 56kb file. Not anymore.
If these other frameworks are to grow and thrive, they will need to begin to target other aspects or pain-points in web development. Things that are actual concerns for programmers and web developers.
It isn't perfect, but it is very useful still. Not only in reducing the amount of keystrokes, which do add up if you are working on a project with millions of lines of code. But in performing certain tasks that really are tedious to code by hand, such as fading elements in and out, attaching events, making ajax requests and many DOM manipulation tasks as well.
I went years without using it myself favoring the more vanilla approach to coding, which has its benefits for sure. More control of your code being the primary one. But this might not be so important or even that frequently required really.
If you are using jQuery and have read online about why it's a dying framework, I am here to assure you that it is not. It's still very much alive and ticking and growing in terms of usage. To quote the Dark Knight:
You either die a hero, or live long enough to see yourself become the villain.
Did you find this article helpful?
Sign up for my weekly coding tips!
Walter Guevara is a Computer Scientist, software engineer, startup founder and currently mentors for a coding bootcamp. He has been creating software for the past 15 years.