jQuery 4
242 points
4 hours ago
| 22 comments
| blog.jquery.com
| HN
flomo
38 minutes ago
[-]
Whenever HTMX comes up here, I always think "isn't that just some gobbledy-gook which replaces about 3 lines of imperative jquery?"

Anyway, jQuery always did the job, use it forever if it solves your problems.

reply
gbalduzzi
24 minutes ago
[-]
The problem with jQuery is that, being imperative, it quickly becomes complex when you need to handle more than one thing because you need to cover imperatively all cases.
reply
CSSer
8 minutes ago
[-]
I remember the first JS bug I ever fixed. I came across a flickering menu implemented with jQuery that didn't properly handle nested hover states. It resulted in an infinite flickering effect. It really drove this point home for me. Such a simple thing, with such an easy oversight, creating such a mess when there are now much easier solutions.
reply
blakewatson
3 hours ago
[-]
Related: This is a nice write-up of how to write reactive jQuery. It's presented as an alternative to jQuery spaghetti code, in the context of being in a legacy codebase where you might not have access to newer frameworks.

https://css-tricks.com/reactive-jquery-for-spaghetti-fied-le...

reply
Klaster_1
2 hours ago
[-]
I used this approach before and it indeed works better than the 2010-style jQuery mess. A good fit for userscripts too, where the problem you attempt to solve is fairly limited and having dependencies, especially with a build steps, is a pain. Note that you don't need jQuery for this at all, unless you are somehow stuck with ancient browser support as a requirement - querySelector, addEventListener, innerHtml - the basic building blocks of the approach - have been available and stable for a long time.
reply
doix
2 hours ago
[-]
Unfortunately, nowadays writing userscripts is much harder than it used to be. Most websites are using some sort of reactive FE framework so you need to make extensive use of mutationObservers (or whatever the equivalent is in jQuery I guess).
reply
Klaster_1
44 minutes ago
[-]
Very true. I guess that depends on what websites you find issues with? I just checked mine and all of those are quality of life improvements for fully server rendered sites like HN or phpBB forums.
reply
doix
27 minutes ago
[-]
Yeah, I mostly use it for QoL improvements but for work related things. So Jira, Bitbucket, GitHub, Linear etc. basically whatever my employer uses. Back in the early 2010s most of that software was fully software rendered. Nowadays it's pretty rare for that to be the case.

I just try and get LLMs to do it for me because I'm lazy, and they like to use setInterval instead of mutationObservers and if it works, I just live with the inefficiency.

reply
lrvick
12 minutes ago
[-]
Everything I ever used jquery for 15 years ago, I found myself able to do with the CSS and the JS standard library maybe 10 years ago. I honestly am confused when I see jquery used today for anything.

Is there still anything jquery does you cannot easily do with a couple lines of stdlib?

reply
jampekka
4 minutes ago
[-]
Jquery does many things in one line that requires a couple lines of stdlib. Writing less code is what libraries are for.
reply
karim79
3 hours ago
[-]
Still one of my favourite libs on the whole planet. I will always love jQuery. It is responsible for my career in (real) companies.

Live on jQuery! Go forth and multiply!

reply
b3ing
4 hours ago
[-]
Nice to see it still around and updated. The sad part is I guess this means React will be around in 2060.
reply
mikeaskew4
2 hours ago
[-]
by 2060 React Native should be up to v0.93
reply
b65e8bee43c2ed0
3 hours ago
[-]
there are already de facto two Reacts. by 2060, there will be five.
reply
2muchcoffeeman
3 hours ago
[-]
Two Reacts!?
reply
exac
3 hours ago
[-]
As someone who doesn't use React, there is React Native (for iOS & Android), and React (and that can be server-rendered or client-rendered).
reply
psnehanshu
1 hour ago
[-]
There's also React Native Web
reply
underdeserver
22 minutes ago
[-]
I'm sorry what
reply
atulvi
1 hour ago
[-]
There was also react vr
reply
tcoff91
2 hours ago
[-]
class components & function components.
reply
afiori
1 hour ago
[-]
That is the least interesting divide in the react community
reply
rationably
4 hours ago
[-]
Unbelievably, still supports IE 11 which is scheduled to be deprecated in jQuery 5.0
reply
indolering
2 minutes ago
[-]
It looks like it was done to not delay the 4.0 release. Since they follow semvar, that means it won't get the axe until 5.0 [1]. Pretty wild considering that 3.0 was released 10 years ago.

But maybe they will scope this one better: they were talking about getting 4.0 released in 2020 back in 2019!

[1]: https://github.com/jquery/jquery/pull/5077 [2]: https://github.com/jquery/jquery/issues/4299

reply
tartoran
4 hours ago
[-]
Backwards compatibility. Apparently there are still some people stuck on IE11. It's nice that jQuery still supports those users and the products that they are still running.
reply
kstrauser
25 minutes ago
[-]
This is the part that I find the strangest:

> We also dropped support for other very old browsers, including Edge Legacy, iOS versions earlier than the last 3, Firefox versions earlier than the last 2 (aside from Firefox ESR), and Android Browser.

Safari from iOS 16, released in 2022, is more modern in every conceivable way than MSIE 11. I'd also bet there are more people stuck with iOS 16- than those who can only use IE 11, except maybe at companies with horrid IT departments, in which case I kind of see this as enabling them to continue to suck.

I'd vote to rip the bandaid off. MSIE is dead tech, deader than some of the other browsers they're deprecating. Let it fade into ignomony as soon as possible.

reply
phinnaeus
3 hours ago
[-]
Are those people/products upgrading jQuery though?
reply
jbullock35
3 hours ago
[-]
Who is still stuck on IE 11---and why?
reply
flomo
44 minutes ago
[-]
There are some really retrograde government and bigcorps, running ten year old infrastructure. And if that is your customer-base? You do it. Plus I worked on a consumer launch site for something you might remember, and we got the late requirement for IE7 support, because that's what the executives in Japan had. No customers cared, but yeah it worked in IE7.
reply
ddtaylor
3 hours ago
[-]
I think anything still using ActiveX like stuff or "native" things. Sure, it should all be dead and gone, but some might not be and there is no path forward with any of that AFAIK.
reply
ejmatta
3 hours ago
[-]
Some corporate machines still run XP. Why upgrade what works?
reply
ExpertAdvisor01
3 hours ago
[-]
SECURITY
reply
Joel_Mckay
2 hours ago
[-]
Yet it would still run Windows Adware edition. =3
reply
ulrischa
1 hour ago
[-]
Not everybody in the world can use modern hard- and software. There are tons of school computer labs running old software
reply
halapro
1 hour ago
[-]
Yes, run jQuery 3.

Crazy to think that software running inside IE11 should use the latest version of a library.

reply
gethly
49 minutes ago
[-]
jQuery was peak JavaScript.

Good times, I'm glad it is still around.

reply
shevy-java
39 minutes ago
[-]
It is still used by many websites.
reply
marticode
16 minutes ago
[-]
Indeed. Though a lot of its feature found their way into plain vanilla Javascript and browsers, the syntax is still so much easier with jQuery.
reply
chao-
1 hour ago
[-]
I cannot express how much I admire the amount of effort jQuery puts into their upgrade tools.
reply
ulrischa
55 minutes ago
[-]
I still love the simplicity a ajax call can be done in Jquery
reply
jusonchan81
3 hours ago
[-]
The first time I truly enjoyed web development was when I got the hang of jQuery. Made everything so much simple and usable!
reply
Joel_Mckay
2 hours ago
[-]
jQuery made a messy ecosystem slightly less fragmented. Combined with CKEditor it effectively tamed a lot of web-developer chaos until nodejs dropped. =3
reply
indolering
2 hours ago
[-]
I love that they support ES6 modules, Trusted Types, and CSP! The clearing out of old APIs that have platform replacements is nice to see too!
reply
maxpert
1 hour ago
[-]
jQuery is the last time I felt a library doing magic! Nothing has matched the feelings since then.
reply
Minor49er
1 hour ago
[-]
Not even modern vanilla JavaScript?
reply
marticode
15 minutes ago
[-]
It's fairly close now but so much more verbose: ie document.getElementById('theID') vs $('#theID')
reply
majewsky
8 minutes ago
[-]
Nearly every time I write something in JavaScript, the first line is const $ = (selector) => document.querySelector(selector). I do not have jQuery nostalgia as much as many others here, but that particular shorthand is very useful.

For extra flavor, const $$ = (selector) => document.querySelectorAll(selector) on top.

reply
NetOpWibby
2 hours ago
[-]
I remember being scared of jQuery and then being scared of vanilla JS. My, how time flies.

Incredible it's still being maintained.

reply
shevy-java
39 minutes ago
[-]
I am still using jQuery.
reply
yread
1 hour ago
[-]
Hmm maybe i can finally move on from 2.x
reply
MarkdownConvert
3 hours ago
[-]
Long-time user here. It served me well for years, though I haven't really touched it since the 3.0 days. Glad to see it's still being maintained.
reply
netbioserror
3 hours ago
[-]
I was surprised that for most of my smaller use cases, Zepto.js was a drop-in replacement that worked well. I do need to try the jQuery slim builds, I've never explored that.
reply
NetOpWibby
2 hours ago
[-]
Zepto! That's a name I haven't heard in years. I don't remember how it happened but I'm still a member of the ZeptoJS org on Github.
reply
tpoacher
2 hours ago
[-]
still needs more jQuery
reply
tonijn
3 hours ago
[-]
No love for $…?
reply
gocsjess
2 hours ago
[-]
jQuery is v4 now, but a lot of sites esp. wordpress still have 1.11 or 1.12 and only uses them to either doing modals(popover), show/hide(display), or ajax(fetch).
reply
nchmy
2 hours ago
[-]
WordPress ships with 3.x and is already looking to update to 4
reply
madduci
1 hour ago
[-]
This is huge. jQuery is still my way to go for any website requiring some custom interaction that isn't available in vanilla js.
reply
maxloh
4 hours ago
[-]
Even after migrating to ES modules, jQuery is still somewhat bloated. It is 27 kB (minified + gzipped) [0]. In comparison, Preact is only 4.7 kB [1].

[0]: https://bundlephobia.com/package/jquery@4.0.0

[1]: https://bundlephobia.com/package/preact@10.28.2

reply
topspin
18 minutes ago
[-]
> Preact is only 4.7 kB

Is there some outlier place where people using virtual DOM frameworks don't also include 100-200kb of "ecosystem" in addition to the framework?

I suppose anything is possible, but I've never actually seen it. I have seen jQuery only sites. You get a lot for ~27kB.

reply
onion2k
3 hours ago
[-]
jQuery does a lot more though, and includes support older browsers.
reply
ZeroAurora
33 minutes ago
[-]
Officially they state they only support 2 latest versions of chrome. But considering their support of IE11, that's actually a lot.
reply
halapro
1 hour ago
[-]
> includes support older browsers

Which is entirely the issue. Supporting a browser for the 10 users who will update jQuery in 2025 is insane.

reply
mejutoco
43 minutes ago
[-]
Breaking backwards compatibility to turn 27kb into less because of "bloat" makes less sense to me.
reply
shevy-java
37 minutes ago
[-]
It is definitely more than 10 users.
reply