TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

You might not need jQuery (2014)

166 pointsby lemonspatover 4 years ago

24 comments

jamiesonbeckerover 4 years ago
It&#x27;s ironic that there&#x27;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&#x27;t aged well. I&#x27;ve come full circle and am now using jQuery again.
评论 #25772282 未加载
评论 #25771555 未加载
评论 #25771526 未加载
评论 #25771531 未加载
评论 #25771408 未加载
评论 #25772721 未加载
评论 #25773086 未加载
评论 #25774696 未加载
评论 #25771682 未加载
评论 #25772170 未加载
评论 #25779081 未加载
评论 #25773162 未加载
评论 #25771878 未加载
评论 #25771622 未加载
评论 #25777161 未加载
评论 #25771557 未加载
评论 #25771792 未加载
评论 #25777395 未加载
评论 #25772330 未加载
franciscopover 4 years ago
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:&#x2F;&#x2F;umbrellajs.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;umbrellajs.com&#x2F;</a><p>It&#x27;s heavily inspired by &quot;You might not need jquery&quot; as the intro shows! Lots of the methods are just like in these examples, only with looping&#x2F;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&#x27;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.
cocktailpeanutsover 4 years ago
What we need in 2021 is not this site, it&#x27;s a youmightnotneedreact.com
评论 #25775308 未加载
评论 #25773366 未加载
评论 #25771497 未加载
评论 #25775235 未加载
评论 #25775475 未加载
halisover 4 years ago
Having used react and redux for several years now, I&#x27;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.
评论 #25775391 未加载
评论 #25774124 未加载
评论 #25773636 未加载
评论 #25775514 未加载
评论 #25772912 未加载
评论 #25771841 未加载
评论 #25771800 未加载
评论 #25775244 未加载
nateover 4 years ago
I miss jQuery. It&#x27;s funny that an argument against jQuery is &quot;oh, but you have to load that big thing to access your site&quot;, but then we&#x27;ll create Single Page Apps that then proceed to spend loading json for 10 seconds before we start interacting with them. :)
评论 #25777006 未加载
abiogenesisover 4 years ago
Now only if someone could combine the snippets on the right hand side in an easy-to-use library.<p>Oh wait...
评论 #25772079 未加载
humanover 4 years ago
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.
评论 #25774592 未加载
评论 #25772908 未加载
fabiospampinatoover 4 years ago
I&#x27;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&#x2F;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&#x2F;paste it from Cash.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;fabiospampinato&#x2F;cash" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fabiospampinato&#x2F;cash</a>
_slyoover 4 years ago
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&#x27;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!
fergieover 4 years ago
Haven&#x27;t used jQuery in years. This page is encouraging me to give it a whirl again.
Mootyover 4 years ago
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&#x27;m still confused why people needs node&#x2F;react or vue to achieve simple thing that back in the days where pretty easy to do with basic php&#x2F;jquery. Simplicity in coding was better at the time.
评论 #25773961 未加载
porkerover 4 years ago
And yet, jQuery&#x27;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&#x27;s fashionable to go to heavier ones like axios).<p>I still grab jQuery into projects for the sheer convenience.
DangerousPieover 4 years ago
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&#x27;m not even aware of. And for some things I still ended up requiring jQuery, because they just weren&#x27;t feasible to do in vanilla JS.<p>I have actually gone back to making heavier use of jQuery again these days.
评论 #25775690 未加载
jojobasover 4 years ago
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.
dangover 4 years ago
Discussed at the time: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7152068" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7152068</a>
评论 #25772772 未加载
barnaclejiveover 4 years ago
Someone should make a youmightnotneedspringboot.com
评论 #25771646 未加载
评论 #25771793 未加载
hathymover 4 years ago
The first example alone (3 lines vs 18) convinced me that I still need jQuery.
donutdan4114over 4 years ago
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:&#x2F;&#x2F;content.cdn.viber.com&#x2F;stickers&#x2F;144&#x2F;10400&#x2F;00010400.png" rel="nofollow">http:&#x2F;&#x2F;content.cdn.viber.com&#x2F;stickers&#x2F;144&#x2F;10400&#x2F;00010400.png</a>
评论 #25773333 未加载
austincheneyover 4 years ago
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.
评论 #25773474 未加载
m1kalover 4 years ago
It&#x27;s funny this site doesn&#x27;t mention dialog - the only feature I&#x27;m using that is hard to replace by vanilla JS...<p>jQuery speeds up development, but in most situations it&#x27;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.
评论 #25777875 未加载
thrownaway561over 4 years ago
All that sites does is make me glad I still use jQuery. If something is working and saves me time, I don&#x27;t see the reason for me to have to replace it simply cause it is the next hot thing. jQuery has it&#x27;s place in the world.
bisRepetitaover 4 years ago
One thing I need jQuery for: tracking progress on file upload. Fetch does not do it.
thecrumbover 4 years ago
2021 ... still using jquery
murtazakhussainover 4 years ago
wow, no other proof is needed to user jQuery :)