r/learnjavascript • • Oct 01 '21

jQuery, the greatest JavaScript library of all time, appears to have peaked in usage.

Post image
275 Upvotes

81 comments sorted by

11

u/kevinmrr Oct 01 '21

I cannot count the number of devs I've seen grapping with some SPA framework for a site with 1-4 views, and it's like "We should just use jQuery...."

73

u/ognusdev Oct 02 '21

Goodbye jQuery :) and Thank you.

Imho jQuery was one of the biggest things that happened to JavaScript. Maybe only second to Node.

23

u/kry1212 Oct 02 '21

…..this is more an indication people will be continuing to maintain it for longer than we might have expected 5 years ago. That’s the opposite of goodbye.

3

u/OnlyProductiveSubs Oct 02 '21

It's the beginning of a goodbye. It just received an expiry date

1

u/[deleted] Oct 02 '21 edited Oct 02 '21

I suspect that the peak and the tiny dip on the graph is due to the impact of pandemic and lockdowns on businesses in the middle of 2020. jQuery is still loved by millions of developers around the world, and that bonding will likely continue to grow.

jQuery is just too easy to pick up and run with at top speed.

9

u/[deleted] Oct 02 '21

So is vanilla JS

-3

u/[deleted] Oct 02 '21

There are enough number of cross-browser quirks even today to stifle a free run with vanilla JS. Polyfills or jQuery—you gotta choose one!

4

u/[deleted] Oct 02 '21

Uh, not really.

2

u/[deleted] Oct 02 '21 edited Oct 02 '21

Uh, really. 🙂

But only if you can show a web app with vanilla js that doesn’t use a polyfill!

3

u/[deleted] Oct 02 '21

Given the sheer number of apps running on the web I can guarantee oh there are hundreds if not thousands that don't use polyfills.

2

u/oxamide96 Oct 03 '21

For what it's worth, I've never used polyfills or jQuery in any projects in the past few years. I don't think it's needed in so many cases.

2

u/SoBoredAtWork Oct 02 '21

Unless you need to target IE 10 or below, I haven't needed to use jQuery or polyfills in a very long time.

-3

u/[deleted] Oct 02 '21

No one is talking about IE10 or IE12 here.

Even the modern browsers have several quirks, especially when you look at Safari on desktops, iOS Safari, the stock Android browser, and even Firefox and a bunch of other web browsers.

Web is NOT just Chrome, which too has a bunch of quirks depending on web apis, standards, and implementation.

You’ll learn about those once you’ve created something at scale. 👏🏻

5

u/SoBoredAtWork Oct 02 '21 edited Oct 02 '21

You’ll learn about those once you’ve created something at scale. 👏🏻

Lol. Asshole.

First of all, I graduated with a CS degree 16yrs ago and have been a web/software developer since. I was at a hedge fund for 9 years and now I'm at one of the "big 4". I've developed plenty of large scale apps. Second, I'm lucky enough to (and many times have fought to) develop against the top 90-95% popular browsers.

Yes, Android browser and Safari blows. Luckily, they usually don't fall into that category. And if you have to support them, you write you application as you normally would, test in those shit browsers and fix what's broken. Use polyfills if you need to.

It seems like you're arguing that jQuery still has it's place in web development. It was incredible and changed the web dev landscape, but it is no longer necessary unless you're supporting IE10 or worse.

You're just wrong and I can't take you seriously.

-1

u/[deleted] Oct 02 '21 edited Oct 04 '21

16 years of experience and you still haven’t learned to discourse on the web properly without “losing it”? 🙂

The world doesn’t care or is supposed to know the length of your experience. Or that you currently work 9 to 5 for one of the big four.

Rather, it is practically worthless now because your hateful comments make it clear that you are not a good person to be around and work with.

It seems like you're arguing that…

Well, it is not my job to fix what you “saw” in my comments or do on the Internet.

In the parent comment my say was that you’ll either use polyfills+vanilla or jQuery to handle the browser quirks. Choose either one. You have only repeated what I have said earlier so all there is left for you now is to go 🦍💩again.

→ More replies (0)

1

u/the_friendly_dildo Oct 02 '21

Try saying that about lower performance embedded appliances. jQuery sucks ass in those environments.

13

u/[deleted] Oct 02 '21

Its probably because of shopify and all these other cms sites. I had to use jQuery all the time at my last e-commerce job

3

u/inabahare Oct 02 '21

And also things like bootstrap that required it to work. With all the CMS themes made in those versions of bootstrap

1

u/nosebevies Oct 02 '21

Shopify used jQuery in all their starter themes lol

1

u/corporaljustice Oct 02 '21

jQuery comes bundled with Wordpress core too!

Or at least it did up until a few years ago when I moved away from it…

1

u/nosebevies Oct 02 '21

Shocking isn't it? Nothing against jQuery, but leave that upto the developer to make it a core thing

1

u/[deleted] Oct 02 '21

Webflow has that pre-placed, you can't remove it even if you wanted to

1

u/crazedizzled Oct 02 '21

Mostly WordPress I'd imagine. It's not uncommon to have 4 different versions of jQuery running at the same time on WordPress.

24

u/CardinalHijack Oct 02 '21

What's amazing is that I have not worked on jQuery in 6 or so years of web development, across multiple companies yet its still this popular in terms of use.

jQuery solved a problem, and has since pretty much been replaced (for better or worse) in the popular domain. I wonder how long the likes of React, Vue and Angular will stick around beyond their expiry date.

The adoption of a technology lasts far, far longer than its popularity.

20

u/xRockTripodx Oct 02 '21

Jquery has largely been replaced by ES6. I actively go out of my way to avoid jQuery whenever I can. We don't even use it in our WP starter theme anymore, outside of Bootstrap 4's requirement for it.

-6

u/Negative12DollarBill Oct 02 '21

How could jQuery be replaced by ES6? That's like saying a semi-trailer was replaced by a power station, they're not even in the same category.

10

u/corporaljustice Oct 02 '21

Because with new ES6+ methods you can do many things simply in vanilla JS that previously required jQuery if you didn’t want to write a lot of verbose lines.

Using vanilla JS before document.querySelectorAll() came about without JQ was a pain.

$() is very similar to querySelectorAll().

4

u/RobertKerans Oct 02 '21 edited Oct 02 '21

I get what you mean but you're talking about additions to the browser API that were introduced as a response to jQuery + normalisation of the browser API as browsers became an application platform. Nothing to do with ES. The two core jQuery APIs were the selector engine and AJAX. Browsers added querySelector[All] and fetch (+ a load more jQuery-like stuff) + non-evergreen browsers are now uncommon, so the browser APIs now cover most jQuery use-cases.

IMO, and I'm stretching here, the only thing in ES, in JS, that's really made a difference is modules (one of the issues with jQuery is its non-modular architecture), and that's tangential, it's not directly related to functionality

3

u/corporaljustice Oct 02 '21

I see what you’re saying, and you’re right, I wasn’t separating ES6 and new browser APIs.

I stand corrected!

2

u/0xnoob Oct 02 '21

^

querySelectorAll was available in Browsers around 2009, ES6 came out in 2015. While I understand that you still needed jQuery back then to support older browsers, it still had nothing to do with ES6.

3

u/Nerwesta Oct 02 '21

In fact, querySelector is an idea taken from jQuery if I'm not mistaken. Same energy for ajax before Fetch API, which to put it simply was a pain to do with vanilla JS at those times. Ajax jQuery was a breeze.

2

u/0xnoob Oct 02 '21

Neither querySelector nor fetch are part of ES6.

querySelector was available in Browsers since around 2009. While fetch was available around the same time as ES6 in 2015, it still isn't part of it.

0

u/Negative12DollarBill Oct 02 '21

If all jQuery did was make it easier to select document elements, we wouldn't be talking about it.

2

u/corporaljustice Oct 02 '21

Give me an example of some jQuery that would be hard to implement in modern vanilla JS?

2

u/hanoian Oct 02 '21 edited Oct 02 '21

"hard" is a big qualifier to add in there. Of course you can everything in Vanilla, but jQuery still makes dom traversal easier. The same way everything can be done without lodash, but it's still useful.

Don't touch it myself anymore really but it has its place. If I want to scrape data, it's often jQuery. If I use cypress, it's pretty much jQuery.

1

u/ZergistRush Oct 02 '21

Use to make it easier, all the huge methods used for traversing the DOM from jQuery is now native.

2

u/hanoian Oct 02 '21 edited Oct 02 '21

https://tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/

https://i.imgur.com/T76smsM.png

I don't even like using jQuery but to say it used to be easier because other native methods now exist is kind of missing the point.

.parent().parent().find('.my_point').show() is objectively easy.

It's a tool. It's syntactic sugar really. useState() isn't pointless just because you could do it in vanilla. lodash isn't pointless just because you can write those functions yourself.

We compile modern JS and TypeScript back into "native" JS anyways so loads of modern stuff is effectively what jQuery brought to us.

-2

u/Negative12DollarBill Oct 02 '21

You're the one making the extraordinary claim dude, are you not familiar with Russell's teapot?

Of course one thing jQuery did which was really important was abstract away the differences between incompatible browsers; you could set the CSS of an element and not worry that IE did styles a different way.

I suspect a lot of what you're calling "ES6" or "modern JS" is a category error for "browsers all behave better nowadays".

2

u/[deleted] Oct 02 '21

jQuery solved a problem

Genuine question, what problem did jQuery solve? I'm guessing it's making HTML elements easier to access, right?

10

u/alexbarrett Oct 02 '21

It inspired the query selector API we use today and provided easier ways to create and manipulate those elements en masse.

It's probably partially the reason fluent interfaces are so popular in JS.

It smoothed over browser differences, made XHR easier to use and brought animations into the mainstream.

The modern web is jQuery's legacy.

2

u/Nerwesta Oct 02 '21

Oh god, the good old fadeIn / toggle animations. Time flies.

0

u/[deleted] Oct 02 '21

Lmao I’m a tech intern and I recently made a post asking recruiters how I should interact with them to help me find internships/jobs in the tech field. One person said in their response that they hate seeing jQuery on resumes and if you don’t have React/Vue/Angular then you p much don’t know JS. I think I get their point but I strongly disagree with that statement about not knowing JS…

6

u/hanoian Oct 02 '21

I wouldn't particularly disagree with that to be honest. I thought I knew JS when I was using jQuery to do bits and pieces in Drupal.

But using npm building out proper apps in JS is entirely different. JS started to feel like a real thing when I got away from jQuery's uses.

1

u/[deleted] Oct 02 '21

Fair point.

3

u/inabahare Oct 02 '21

You know that thing where you make something really clean and really neat, but then a customer calls in saying it doesn't work, and it turns out they use safari and why would you have nice things?

Well think of that, but with all browsers. The main thing jquery did was give you a lot of functions that worked cross-browser, which weren't a guarantee

3

u/dkbot Oct 02 '21

For me a long time ago, it helped solve the issues with cross browser comparability with the older IE versions. I think that plus the Ajax piece just ended up making it stick, easier to understand syntax for newer developers as well.

2

u/Nerwesta Oct 02 '21

Very simple way to do Ajax. To me it was a no brainer.

2

u/crazedizzled Oct 02 '21

Most importantly, it solved cross browser inconsistencies.

Beyond that, it introduced a way to access and manipulate the dom in a fairly clean way. Back then it was very convoluted to do those things in vanilla js.

It also brought a good way to handle AJAX, which was again very convoluted in vanilla js.

Pretty much every problem that jQuery solved is now available in vanilla js in ES6+.

2

u/LakeInTheSky Oct 02 '21

The biggest problem they initially solved was cross-browser support.

When jQuery was first released, the most popular browser was Microsoft Internet Explorer. The problem is, MS IE had terrible standards support.

Some standard functions were implemented incorrectly, e.g. they required different parameters, or they didn't return the values you expected. And some standard APIs weren't implemented at all. IE also had its own non-standard API to do some tasks, like the document.all object to access elements by their ID.

This was a big source of pain for developers, because if you developed apps following the standards, they broke on IE, but if you use the IE proprietary APIs, the apps then broke in other browsers. You could spend hours fixing these compatibility issues.

With jQuery, you could use a single API and it would work in every browser. Internally the library would find out in which browser it's running and would call the right methods to do the task.

BTW, IE had bad standards support on purpose, it was a tactic to maintain their market share.

As cross-browser support was difficult, some dev teams chose ignore cross-browser support and make the websites work on IE only. Sometimes, it was just a bad practice by those teams, but often they did it because they had the pressure from management to ship websites fast.

If a user visited one of those websites with an alternative browser, it would break, obviously. The thing is, is the user wasn't tech-savvy, they would incorrectly blame the browser, and they would switch back to IE.

1

u/crazedizzled Oct 02 '21

jQuery is made completely obsolete by ES6+. React, vue, angular, etc solve a much different problem that probably won't become part of vanilla js.

6

u/[deleted] Oct 02 '21

I have actively refused to deal with jQuery. To me, that library removes all the fun from learning javascript. jQuery is someone else that figured out how to do in javascript all the neat stuff that I want to learn how to do. It's like a person that wants to learn to read english having a person follow them around reading everything out loud for them. It's nice and all, but I don't want it to just work, I want to know how it works and why. Ever so often, I find myself breaking into the code of jQuery to see how they did a thing.

It's just such a crap thing, you know? You look up how to do a thing in JavaScript for the answer to only have jQuery. "Well!" I think, "it's nice to know that want I'm wanting to learn can and has already been done but can you tell me how, please?" Just frustrating is all. jQuery is obviously done by people that knew javascript very well but I'd like to learn too. Plus, most people run jQuery from another site like google. That's fine, I guess, if you don't mind the call to a domain you don't control and can be assured that it'll always be there. if not, you have to have the overhead of the entire library even if you only ever use one or two functions from it. I don't know, I just never cared for not used it, really, ever. Yes, I'm doing it the hard way but at the end of the day, if jQuery goes away, I'll still know how to code javascript.

But those are just my personal feelings about it.

1

u/letmetrythis Oct 03 '21

That's the exact reason why the webpage https://youmightnotneedjquery.com/ exists. I always use it when I come onto a solution that uses a jquery..

10

u/warpedspockclone Oct 02 '21

document.querySelector

0

u/[deleted] Oct 23 '21

[deleted]

2

u/warpedspockclone Oct 23 '21

I prefer not side loading a massive dependency to do a simple task. I know that thought is almost an antipattern in the JS world.

3

u/Nerwesta Oct 02 '21

I wonder if it's correlated by Bootstrap ditching jQuery as well. Anyhow, goodbye my old friend.

2

u/[deleted] Oct 02 '21

Even the developer doesn't use it in any of his projects or work but still maintains it for all

1

u/yigitjohn48 Oct 02 '21

When i looked up on the internet about is jquery dying and every forum, responses are saying "yes its dying, don't use it!" kinda answers. Looks like they are bunch of crappy developers :D

1

u/SoBoredAtWork Oct 03 '21

Are you being serious?

jQuery is not dying. It's dead. It was amazing and it changed the web dev landscape forever. But should no longer be used in any modern app. It's 100% unnecessary.

Also, if every forum is saying don't use it and you disagree, maybe you're the one that's wrong.

1

u/Alex__Lazar Oct 02 '21

It was a good run, if it indeed keeps on going down.

1

u/uuykay Oct 02 '21

JQuery was a great tool, unfortunately no longer trendy, but it was refreshing to control the DOM yourself rather than what we do now with a virtual DOM

1

u/SoBoredAtWork Oct 03 '21

It's not no longer trendy. It's no longer necessary. ES6+ has adopted a TON of things that jQuery solved (querySelector, fetch, dom manipulation, etc). No one needs to include jQuery for a modern app.

1

u/uuykay Oct 05 '21

If you've never used jQuery, I can see why you might think that from the outset. However jQuery provides some nice things that vanilla JS does not. For example, it handles errors much better. Let's say you want to get a button by ID and add a class to it.
The jQuery way:
jQuery("#someButtonThatExists").addClass("primary")

The vanilla JS way:
document.getElementById("someButtonThatExists").classList.add("primary")

Now say the button does not exist on the page for whatever reason and the above javascript still ran. jQuery will not error, whereas vanilla JS does error, because document.getElementById returns null, so it cannot read classList from it.

This is just one example. jQuery also provides ajax which is compatible with IE, if you care about supporting older browsers you can't just use fetch. It also has animations and a whole bunch of other things.

jQuery still provides a lot of utility even today in my opinion.

2

u/SoBoredAtWork Oct 06 '21

`document.querySelector('#someButtonThatExists')?.classList.add('primary')` works as expected if the element doesn't exist (note the ? before `classList`)

Ajax is very simple with fetch. Or Axios.

https://dmitripavlutin.com/javascript-fetch-async-await/#2-fetching-json

You didn't need to add a library for either of the above. Especially if you use babel.

jQuery was amazing and it changed the industry forever. I started web development using jQ exclusively, for many years. It was hard to get used to vanilla JS, but so much of what jQ offered is included in ES6+ and modern browsers are generally compatible with everything (babel clears up the rest).

It took so long to undo my dependence on jQuery, but I would never go back. Life is fine without it and everything works. You don't need it.

1

u/hanoian Oct 02 '21

From reading these comments, I feel there's a disconnect between people using JS libraries and frameworks to create html from apis and people using jQuery to manipulate html from the backend.

jQuery most certainly has it's place, even still. As the graph shows. You don't build a headless front-end with it but if all you need to do is manipulate what php etc. is providing, then it works.

Vanilla works as well nowadays but jQuery still abstracts away some things that make your workflow easier.

The best advice is to not use it and learn vanilla. But if it's already there, which is on almost every website, then go ahead. If I open the console here and type $ = j, then $ = jQuery pops up.

1

u/BurntBanana123 Oct 02 '21

Buy the dip?

1

u/knowthyself2020 Oct 02 '21

Sell! Sell!! Sell!!!

1

u/esamcoding Oct 02 '21

a library that fulfilled a dire need. long death jquery!

1

u/AstroOtterSpace Oct 06 '21

Finaly !! 10 years ago, jQuery was great and amazing. Now, it's useless, many jquery functions can be do easily in vanillajs (event without vueJS, React or Angular).

For example, I prefer doing a asynchronous request with fetch than using `$.ajax()` for making an Ajax request

1

u/pookage helpful Oct 02 '21

Burn it to the ground.

0

u/inabahare Oct 02 '21

Also it should be noted that jquery isn't a framework but a library

And that the greatest library of all time is date-fns

0

u/[deleted] Oct 02 '21

[deleted]

11

u/jaredcheeda Oct 02 '21

me too

if it wasn't for Vue I would have quit when React started becoming popular.

12

u/BenZed Oct 02 '21

React is fantastic.

3

u/Alex__Lazar Oct 02 '21

Functional React is actually cool.

4

u/BenZed Oct 02 '21

Do you just mean react without class components?

2

u/oxamide96 Oct 03 '21

I think they meant that, Yes, functional components and hooks

1

u/Alex__Lazar Oct 31 '21

Precisely. It's so much simpler than class-based components.

2

u/not_a_gumby Oct 02 '21

What do you mean by this?

6

u/jaredcheeda Oct 02 '21

I spent over a decade mastering HTML/CSS while doing design work, convinced that programming wasn't for me. Then jQuery was like "hey, you already know CSS selectors, that's all you need buddy". And before you know it I was doing JavaScript the jQuery way. Fast forward and now I'm a senior software engineer that's worked at some large tech companies.