Update - June 2020: This article was originally written in 2019. A lot have changed after that. For example, recently, Bootstrap has announced that it's going to remove jQuery dependency starting from v5. So, some of the points below may seem outdated.
Then I thought I would write about what I have understood as a spectator. I have tried to view the topic from multiple viewpoints before coming to a realistic conclusion.
What is JQuery & How it became so popular?
Due to its ease of use, neat syntax and cross-browser compatibility, it quickly became the favorite tool of front-end developers. It became much popular than other libraries like Mootools, Scriptaculous, and Prototype.
Owing to the popularity, developers around the world began rolling out hundreds of plugins and front-end frameworks depending on JQuery, many of them became popular. That was how this library really established its roots.
What Has Changed After That?
- JQuery gradually lost its uniqueness. This can be attributed to three main things:
- Modern browsers like Google Chrome & Firefox came and they implemented JS consistently
Technologies like AngularJS, React & VueJS came and they made JQuery look obsolete. People began questioning the significance of the latter.
Since one is a library (collection of functions) and the others are frameworksÂ (or framework-like), their use cases never completely overlap each other. A library is good at what it is meant to do and may not be good for what it is not meant for, and vice-versa.
Is Jquery still relevant? What are the current trends?
Even though it is obvious that the library is gradually losing its grounds, it is still relevant.
A lot of websites make use of it. According to BuiltWith, JQuery is still in use on a staggering 77% percent of the top 1 million websites. So if you ever come across to work on such a website, you should know the library.
Apart from the popularity, JQuery is a beautiful library. Its chaining methods are crisp and elegant.
Should you use it?
In web development, an important thing is to choose the right tools and technologies for the job at hand.
When to use it?
Suppose you are working on a simple WordPress website with minimal user interactions. However, you also require a bit of animation or sliders as well. In that case, JQuery comes in very handy. There may not be any need to bring a full framework like React or Vue into the scene.
Another situation is when you have to work with popular front-end framework like Bootstrap which depends a lot on JQuery. However, some people argue that Bootstrap is not a justification to use JQuery. But if you already know Bootstrap and want to quickly develop a page, there is nothing wrong in getting the job done with it.
Basically, you may need to use Jquery if:
- you are working with WordPress or similar content management systems
- the work includes legacy codes or plugins dependent on Jquery
- your app or website targets old browsers also
- you are used to it, and it makes development a lot easier
Now let us see when it may NOT be a good choice.
For User Interfaces & Single Page Apps
One of the main advantage of modern frameworks like Vue is that they have a data layer. That is, you can attach or bind data to the elements on your page. When this data changes, the view also changes automatically. So you don’t need to always access the DOM directly and manipulate it as you do in JQuery. This makes creating complex user interfaces very easy.
Is Jquery dead?
No. It is very much alive because lots of websites and plugins still depend on it. But the trend is going down.
Is it a necessity in 2019?
So, should you learn Jquery if you don’t know it?
Should you use it even if you know it?
It depends. There is nothing wrong if it makes the work better. But it is wise not to over-depend on it.