You don’t need jQuery
Tags: jquery, javascriptlibrary, javascript
Published: 2019-10-19 18:24:32

---
title: You don’t need jQuery
published: true
tags: jquery,javascript-library,javascript
canonical_url: 
---

I recently read this article [**_I Still Love jQuery — And You Should, Too._**](https://hackernoon.com/i-still-love-jquery-and-you-should-too-3114f33f249e) In all honesty, I was a bit surprised that there is someone who is willing to put a case for jQuery in this modern age of development.

![](https://cdn-images-1.medium.com/max/800/1*qKyXecsGDFKV5Gbti-Inzw.jpeg)

The author made a good case for jQuery but there were statements which are not accurate and some aspects of development have been ignored. Let’s look at some of his arguments in favor of jQuery.

#### **jQuery doesn’t make your site slow**

Well, the above statement is false. The author uses this statement but then acknowledges that jQuery does affect the loading time of the page, which is negligible in most cases. Actually, he is right but he fails to put the light in the cases when we need our site to accessible to everyone. In such events,our site may be used by someone with a bad internet connection, and that’s when you would wish your site size was as small as possible.

Even if you use the min/slim version of jQuery, the size difference isn’t much and some features like animations and Ajax are removed in jQuery slim version.

The author also mentions that using jQuery improves your typing speed. That’s true for most parts but there are a lot of cases when jQuery and Vanilla JavaScript both have almost similar lines of code. That’s when you should really consider that do you really want jQuery in your site.

Here are some examples:

```
// Append using jQuery
$(parent).append(el);

// Append using Vanilla JS
parent.appendChild(el);

// Getting Children using jQuery
$(el).children();

// Getting Children using Vanilla JS
el.children

// Get HTML using jQuery
$(el).html();

// Get HTML using Vanilla JS
el.innerHTML
```

Using jQuery is so redundant that there’s a website dedicated to showing the difference between jQuery and Vanilla JS code called [You Might Not Need jQuery](http://youmightnotneedjquery.com/). You can check this website for more examples like the above mentioned.

Also, jQuery Selectors performance was overlooked in that article. Here is a site where you can check and compare jQuery Selector’s performance called [JSPERF](https://jsperf.com/dm-jquery-vs-vanilla-selectors).

Spoiler Alert: The Vanilla JS selector is faster than the jQuery counterpart every time.

![](https://cdn-images-1.medium.com/max/1024/1*uIG2P4s1Zlp0brMy_5boZQ.png)<figcaption>JSPERF’s Result of jQuery and Vanilla JS Selectors</figcaption>

Lastly, one of the main feature of jQuery which is ajax() is not available in slim version and can be easily replaced by fetch method or external libraries like Axios.

In the end, I would like to say that jQuery does add some features as discussed by the author in his [article](https://hackernoon.com/i-still-love-jquery-and-you-should-too-3114f33f249e). Also, using jQuery is a choice but there are better alternatives available. You’ll have to make some trade-offs and choose the option that serves your priorities.