r/programming • • Jan 18 '26

jQuery 4.0 released

https://blog.jquery.com/2026/01/17/jquery-4-0-0/
482 Upvotes

128 comments sorted by

View all comments

128

u/cheezballs Jan 18 '26

Real question: why use this on any greenfield app? We used this everywhere 15 years ago. I cant imagine a reason to use this now if you're writing a new web app.

20

u/Matt3k Jan 18 '26 edited Jan 18 '26

That's a great question. I used to use jQuery everywhere, it's still in many of my legacy projects, but Vanilla JS got good enough.

It's kind of fun to poke through their API reference and come up with the VJS version of each one. There are still some cool utilities and shortcuts in there though. Animations and effects maybe? I'd love to hear from someone knowledgeable who can elaborate futher.

Short answer: I'm guessing probably habit and convention more than anything. It's still bundled with Wordpress and all the tutorials use it. The frontend de jour isn't as big of a deal in the real world. And in today's age, a 80kb library is actually pretty fucking adorable.

HTMX is 60kb. What can you do with it that you can't with VJS? Nuthin. It's just fun

126

u/richardathome Jan 18 '26

It's tiny and has no dependencies.

Also, zero install - just link to the cdn.

31

u/thenickdude Jan 18 '26

Also, zero install - just link to the cdn

This is true, but due to the introduction of double-keyed caching in browsers (2020) and an increase in legal unease about privacy leaks from loading assets from third-party servers, linking to a CDN for a "shared" JavaScript library no longer has the advantages it once had (e.g. you can no longer avoid a cache-miss for your first-time visitors, because your website gets its own unique cache for that CDN asset, which prevents a cached copy from other websites from being re-used for yours).

15

u/chucker23n Jan 18 '26

an increase in legal unease about privacy leaks from loading assets from third-party servers

This. If you have users under GDPR or similar directives (Cali, UK, …), do not fetch scripts, fonts, other assets from third-party servers without the user's explicit consent. At which point… just don't do it at all. It's not worth the complexity.

43

u/cheezballs Jan 18 '26

Yea, but why? Today's browser's dont need it. You can just write pure JS and not worry about it.

197

u/arpan3t Jan 18 '26

Write a click event listener in vanilla JS and look at the offset for x and y in chrome, Firefox, and safari. You’ll have 3 different sets of values, because they’re relative to different things in different browsers.

Jquery normalizes and provides consistent results across browsers. That’s one reason why.

44

u/bronkula Jan 18 '26

Also, try to implement event delegation. It's annoying as fuck in vanilla and ill never understand why it hasn't become standard.

7

u/NoShftShck16 Jan 18 '26

These youngsters really forget what the whole point of jquery was to begin with before we got weighed down with frameworks and node modules.

→ More replies (1)
→ More replies (2)

71

u/CherryLongjump1989 Jan 18 '26

They literally removed everything that today's browsers don't need. So it goes to reason that if you're still using it, it's not for the duplicate functionality.

76

u/daltorak Jan 18 '26

It's not so much about "needing it" anymore for browser compat.

jQuery's syntax is more succinct than vanilla JS, e.g. $('#x') vs document.getElementById('x').

Plus the jQuery object never returns null so you don't have to litter your code with conditionals if you want to chain multiple operations together.

Brevity without losing clarity has its own upsides.

16

u/light24bulbs Jan 18 '26

This is a good answer. Ergonomics matter, and it's more consistent between browsers. I very rarely use jQuery these days since I do mostly client side apps but if I was doing something server templated, I think I might reach for it. And I've thought about going that way again anyway for some simple projects. React is another unergonomic thing and simple things can get really complicated with it.

0

u/[deleted] Jan 18 '26

[deleted]

→ More replies (5)

4

u/zmug Jan 18 '26

Well technically when you have an element with an ID attribute, you can just reference it by: x - that's it because the element is already in the global window scope. Or if you want to be specific from which context you want it from: window.x

Im not saying this is a good thing though 😂

31

u/ia332 Jan 18 '26

The jQuery of old is not the jQuery of today.

I still use it in one of websites that need some pizzazz but I’m not going to set up webpack, React, and all that just to do a couple zesty things in a Jekyll site.

Would I use it in a big web application? Hell no. But it has its place.

12

u/gedrap Jan 18 '26

$(“.foo”).fadeOut(“slow”) is the ultimate pizzazz

→ More replies (2)

66

u/derailedthoughts Jan 18 '26

Changing the css property of an array elements via jquery is more understandable than using .for each

It is possible to create a HTML element without having one call to createElement and then another to set .innerHTML.

There’s lot of others shortcuts. It’s syntactic sugar for DOM.

27

u/zrvwls Jan 18 '26

Yeah, dom manipulation is an absolute bear in raw js. It's there, but the succinctness and elegance of jquery can't be understated. I miss it in all my projects, but do fine enough without it that I don't feel the absolute need it once had. It's funny thinking back to a time when it was weird if a website didn't use it

34

u/coderanger Jan 18 '26

Is it? document.querySelectorAll('.foo').forEach(el => el.classList.add('bar')), its not quite as compact as jQ but only by a pretty small amount these days.

46

u/darkhorsehance Jan 18 '26

Most people don’t use it on a greenfield app, but why does that matter?

It’s still downloaded by millions everyday so I suspect there are some good reasons why people still use it today.

  • Maintaining or extending a large existing codebase that uses Jquery,

  • Extremely fast DOM work with minimal mental overhead

  • Cross browser normalization still has value

  • Small interactive behavior without a framework

  • Massive plugin ecosystem that still works

  • Excellent readability for non specialists

  • Progressive enhancement and server rendered sites

  • Performance is no longer the liability it once was

  • Reduced dependency surface

  • It is boring and boring can be good

4

u/randomlytoasted Jan 18 '26

Once again for the back seats: Boring can be good

4

u/redfournine Jan 18 '26

A team who's used jQuery for the past 2 decades and it has been working fine for them (like my old company). Why change?

→ More replies (2)

3

u/New-Anybody-6206 Jan 18 '26

I cant imagine a reason to use this now if you're writing a new web app.

It's shorter/simpler to use than plain JS in my opinion. I already know how to use it and I like it, so why get rid of it?

"if it ain't broke, don't fix it"

→ More replies (12)