It's ironic that there's probably no bigger sales pitch for jQuery than this site.<p>In every single example, the jQuery version is basically one or two lines of code, versus 10-15 lines for the alternative. (and the jQ version seems significantly easier on the eyes as well.)<p>Also, jQuery supports promises and has for quite a while.<p>This page hasn't aged well. I've come full circle and am now using jQuery again.
I made Umbrella JS back in the day, a 3kb alternative to jQuery born from the question: You might not need jQuery, then what do you need?<p><a href="https://umbrellajs.com/" rel="nofollow">https://umbrellajs.com/</a><p>It's heavily inspired by "You might not need jquery" as the intro shows! Lots of the methods are just like in these examples, only with looping/multiple nodes. Example:<p>$(el).addClass(className);
vs
el.classList.add(className);<p>Do not work the same. jQuery (and Umbrella JS) deal with multiple elements and with multiple class names in multiple formats (as a string, as arguments, etc). That's why I find myself still using Umbrella JS from time to time in smaller non-React projects! Just makes everything a lot easier, for 3kb.
Having used react and redux for several years now, I'm a bit burnt out on how bloated and silly the entire front end has become. If I could decide for myself, I probably would use raw DOM or jQuery at this point.
I miss jQuery. It's funny that an argument against jQuery is "oh, but you have to load that big thing to access your site", but then we'll create Single Page Apps that then proceed to spend loading json for 10 seconds before we start interacting with them. :)
I’d be careful about premature optimization. If you can write your code 2x faster by using jQuery, by all means do it. Eventually, if needed, you could rewrite your JS to be free of jQuery, but it would not be a priority for me. Dev speed if more important than load speed for me.
I'd suggest to anybody wanting a thin wrapper over the DOM to just go with Cash [1] instead, which I maintain.<p>Cash is largely a drop-in replacement for jQuery Slim at a significantly smaller size (~6kb vs ~24kb min+gzip).<p>The methods listed in youmightnotneedjquery.com are a little simplistic/buggy at times and not tested, if you just need a single method from jQuery it would probably be a better idea to simply copy/paste it from Cash.<p>[1]: <a href="https://github.com/fabiospampinato/cash" rel="nofollow">https://github.com/fabiospampinato/cash</a>
jQuery is fantastic. I am not a web programmer by trade, but I can always get busy with jQuery and just a couple of Google searches.<p>Last weekend I was trying to find new car dealerships in my region that carried a particular model of car that I'm interested in. They had a dealer search page that could return all dealerships within 250 miles, and they had an inventory search page that had hardcoded the 3 nearest dealership IDs into the URL. But they had no GUI to search all the cars for all the dealers in my region.<p>I poked around at the elements on the dealership search page, cobbled together a jQuery one-liner to dump all the dealership IDs in my region, and pasted those into the URL to finally see every individual car in my region of the model I wanted. The page took quite a while to load, so probably have have some DoS vulnerabilities to deal with, but at least I was happy.<p>Vanilla javascript would have been so much more cumbersome!
No one mentions the fact that jQuery is still used in Wordpress (33% of all websites) everywhere and (as far as I know) in the last theme version they provided this year.
Which makes it somehow the biggest library around in terms of usage.
I'm still confused why people needs node/react or vue to achieve simple thing that back in the days where pretty easy to do with basic php/jquery. Simplicity in coding was better at the time.
And yet, jQuery's AJAX related methods are more convenient than the native fetch() API.<p>And AFAIK not matched by any simple wrapper for the newer APIs (it's fashionable to go to heavier ones like axios).<p>I still grab jQuery into projects for the sheer convenience.
I bought into this a few years ago and ended up regretting it. My code has become much harder to maintain and read due to all the extra boilerplate code, and it probably has hidden bugs and compatibility issues that I'm not even aware of. And for some things I still ended up requiring jQuery, because they just weren't feasible to do in vanilla JS.<p>I have actually gone back to making heavier use of jQuery again these days.
The biggest benefit of jQuery is concealing some levels of complexity that are somewhat hard to grasp.<p>The biggest flaw of jQuery is concealing some levels of complexity that are absolutely vital to grasp.
Discussed at the time: <a href="https://news.ycombinator.com/item?id=7152068" rel="nofollow">https://news.ycombinator.com/item?id=7152068</a>
jQuery 3+ minified is 31Kb.... Wtf is the problem with that? Can we just admit that vanilla JS is <i>not ideal</i> and having some abstraction (and tiny bit of page load) is worth it? I am not building web apps that are primary used in Sudan with 1G connection. 31Kb is practically nothing. THIS image is larger than that! <a href="http://content.cdn.viber.com/stickers/144/10400/00010400.png" rel="nofollow">http://content.cdn.viber.com/stickers/144/10400/00010400.png</a>
The need for convenience libraries is like parenting with television. It doesn’t seem bad and is just so much easier in every possible way, but any objective observer readily sees the difference in quality of product.<p>The primary reason for that distinction is that you are willing to spend a tiny bit of effort on micro-improvements to quality of product or aren’t, just like parenting. Yes, the effort is ridiculously tiny because it pays for itself with only a trivial amount of practice.
It's funny this site doesn't mention dialog - the only feature I'm using that is hard to replace by vanilla JS...<p>jQuery speeds up development, but in most situations it's straightforward to replace.<p>On the other hand, I never remove React (and especially Reagent) from an existing site - too much effort, too much to break.
All that sites does is make me glad I still use jQuery. If something is working and saves me time, I don't see the reason for me to have to replace it simply cause it is the next hot thing. jQuery has it's place in the world.