The following thoughts are not revelatory, just forgotten by some and never explained to others.
jQuery, once the library of the web, practically synonymous with JavaScript itself, is gradually fading away. And that's just what naturally happens to stepping-stone technology.
I think there's a bit of a myth that jQuery was replaced by React and similar libraries which help handle complex UI manipulations with greater ease than jQuery ever did. However, that's only a small part of the reason jQuery is no longer necessary.
Imperative DOM manipulation is still incredibly valuable and important, but thanks to jQuery's influence, all these nice APIs pretty much ship in the browser.
I was never following the web closely enough to be able to pinpoint with great accuracy which APIs helped tip the scales away from our reliance on jQuery for convenience so I won't try to get into those details (but fetch
comes to mind as a big one).
Here's a more extensive list of how jQuery got rendered obsolete...
jQuery was everything for the web, and its influence on the DOM and window APIs cannot be understated.
If you really want the jQuery sugar, re-implementing it is easier than ever...
Re-implementing jQuery methods in the HTMLElement prototype
Jochem Stoel ・ Dec 6 '18
You probably shouldn't use jQuery for a new webdev project, but that does not mean you shouldn't use direct DOM manipulation. It's the best choice for many situations and so simple to do with plain old JavaScript.
jQuery will always live on in our hearts and our legacy code ❤️
Top comments (13)
I agree 100% with this except the "you probably shouldn't use jQuery for a new project." I love that jQuery is a drop-in that can live and work alongside my own abstractions and modules, as opposed to the all-or-nothing approach with adopting a framework.
I still use jQuery for its primary UI widgets - draggable, resizable, sortable.
Yeah, I agree with all of that... Except I still think the downsides of library size still makes the tradeoff not worth it.
This isn't a hill I'd die on, but it's the side of the coin I'd fall on. If I'm going to drop in a convenience lib I'd rather go with something a lot lighter. Of course if you're building desktop software, internal tools, etc—it probably wouldn't be a big concern. But if you're building for the masses I'd try and be stricter on my budget than to immediately reach for jQuery, even if it is slimmer these days than its peak.
An ongoing joke I have with some of my dev friends is that we argue and debate over payload sizes and when we're done, we put our headphones on and start streaming Spotify at 320 kbps. Haha.
Fair points. However, comparatively, the size of jQuery is relatively small or on par with other libs. jQuery core is 31.3 KB compressed. Meanwhile, Notion, AirTable and other modern apps have JS payloads of over 7 MB, and they don't have a shortage of users. Depends on the target users.
I'd say that the size alone of the libs shouldn't be the only measurement. We should consider the added benefits of that payload throughout the system to justify its size.
You could always use JQueries native tools to build a smaller library with only the components you need if space is a concern (which it definitely should be)
:)
Yeah, I would only use jQuery for its useful plugins.
Otherwise, I would need to know jQuery for Cheerio. But I rarely need to use cash-dom, for instance.
I'd go as far to say that jQuery was detremental for me learning JavaScript. I learnt them side by side, and they became synonymous with each other, and I became I credibly reliant for even the most simplest of things.
As a result it took me longer to understand the language.
$()
was a magical black box that had all the solutions to my problems, but once I peeled back the hood and understood what was happening, I found myself writing cleaner and better code.To be fair at the time JQuery was introduced JS was still quirky and it wasn't updated every few years like it has been since 2015. Those who had to live JS pre-ES6 know that trying to make anything on vanillaJS quickly becomes a pain in the ass. That has changed because JS has become better over the years and the developer culture is shifting away from the imperative model. Developing an app using Vanilla JS is not a feat, but an excersise of inconvenience in today's framework dominated world. just my opinion.
Getting rid of jQuery-only solutions on the first Google search page of "do X in javascript" is the best thing that happened to the modern web in the last 5 years.
Either way, the standards are rapidly evolving: we are slowly but steadily moving towards the modern Web.
Mark my words, the next great thing to be widely adopted is native modules. The feeling of not having to build your modern client-side code is immeasurable. And it feels good.
jQuery is not that faded away as it might seem. It's a common myth from people who develop modern apps and live in "closed" reality.
Believe it or not, but biggest part of the internet is still PHP and countless e-commerce websites that use and rely heavily on jQuery and its plugins.
So is correct, jQuery wasn't "replaced" by React just because they are orthogonal to each other. While React and other frameworks are hyped and cool guys, the very large part of today's websites is still good old backend templating and jQuery.
Believe me, it's not going anywhere in the nearest future.
That’s kind of like saying The Beatles didn’t kill Elvis. 🤔
jQuery won me over because it made me not have to think too hard about differences browsers, when they were more of a thing than they are now (web standards and APIs are much more consistent than when jQuery came on the scene). Now any of that murk happens with polyfills etc.
Jquery and React are tools for different approaches. React way it is SPA in most cases, while jquery is used when you have most of the logic at server (MVC for example) and want to have a thin client. So comparement of these tools is not valid.
JQuery definitely killed Prototype
prototypejs.org/