jQuery Obsolescence?
Tags: jquery, obsolescence, javascript, coding
Published: 2023-03-09 22:24:37

##Full disclosure: 
My jQuery experience is minimal at best. I have used it for a couple of projects this week, but that's about the extent of it so far. That being said, it did get me wondering just how useful it may be for aspiring JS devs to learn. God forbid we learn something we will never use, right?
The topic of jQuery obsolescence was a seed planted earlier this week, when I was searching  online for project advice and jQuery methods. The seed was watered every time I saw an answer from 2009. Seriously though, the vast majority were dated 2015 or earlier. This kicks off a series of searches in which I tried to determine(with my limited understanding) just how important this stuff was for me to know. Here's what I've gathered so far.
jQuery is a popular JavaScript library that was first released in 2006. It has been (very) widely used by developers to streamline the process of writing JavaScript, particularly for DOM manipulation and event handling. However, due to modern web development techniques, the improvement of native JavaScript features, and improvements in cross-browser compatibility and web APIs, some may be wondering whether jQuery is becoming obsolete. Below is a google trends screenshot that does a great job at encapsulating my concerns. 

 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qreaywr2kdkmhn98rrun.png)



##Arguments against jQuery:
One of the main arguments against jQuery is that generally, it is no longer necessary for many modern web development tasks. This means that the majority of newly built sites/apps are not using it. With the introduction of features (such as querySelector and querySelectorAll) in modern browsers, it is now possible to select and manipulate DOM elements without the need for jQuery. This means that developers who are familiar with native JavaScript can accomplish the same tasks without the added overhead of loading a jQuery library. Below is a link that gives the JavaScript equivalents of jQuery functions. 
https://css-tricks.com/now-ever-might-not-need-jquery/

And here is an example of the same code written with both.

JavaScript: 

```
document.getElemementById(“mybutton”).addEventListener(‘click’, function(){
alert(“Hey, You clicked me ?”);
});
```

jQuery:

```
$(‘#mybutton’).click(function(){
alert(“Hey, You clicked me ?”);
});
```

Another argument against jQuery is that it can lead to 'bloated' code and slow page loading times. The library is relatively large and requires additional HTTP requests to load, which can slow down page load times, particularly on mobile devices with slower network connections. This is part of the reason for the rise of "micro-libraries" such as Axios or umbrella JS. Many of these plugins exist and are lightweight compared to jQuery, but contain the most commonly used methods. Here's a list of them. 
https://www.technotification.com/2019/06/5-lightweight-jquery-alternatives-2019.html


##Arguments in favor of jQuery:
Despite these arguments, there are still  developers who prefer to use jQuery, or at least tolerate it. One of the main reasons for this is its historical ease of use and cross-browser compatibility. jQuery was specifically designed to work  across different browsers and platforms seamlessly, which can save developers time and effort, especially when it comes to testing and debugging.

Most notably, jQuery dominates other JS libraries in terms of sheer website numbers. Since such a large number of sites are still relying on Jquery, your chances of running into it are at some point are pretty steep. In that case, it may be best to have at least some past exposure to jQuery in order to best understand what youre looking at. I found more than a handful of reddit comments from devs who spend +50% of their time with jQuery, even when they'd prefer not to. The reason for this is what was just mentioned. The volume of sites using Jquery means that the many devs working on or upgarding legacy systems interact with it daily. See the below link for a great site used to compare technologies!

https://https://www.similartech.com/compare/jquery-vs-react-js

##Conclusion:
While there are certainly arguments for and against using jQuery, the decision ultimately comes down to the individual developer and the specific needs of their project. For developers who are already familiar with native JavaScript and are working on modern web development projects, jQuery may not be necessary. However, for those who are just starting out with web development or  for those who are working on legacy projects that require cross-browser compatibility, jQuery can still be a valuable tool. In my opinion, it looks like some experience with jQuery is an obvious asset, but may not be worth going out of your way to master right out of the gate.
https://youmightnotneedjquery.com/