top | item 39291021

Ask HN: I'm curious to know why should we use jQuery now?

2 points| bapetel | 2 years ago

9 comments

order

ale_jacques|2 years ago

I'm using Unpoly (https://unpoly.com) instead of htmx. One thing that, sometimes, makes me consider pairing it with jQuery are the components built around it.

Stuff like datepickers, autocompletes and whatnot are very consolidated in jQuery world. Sure there are options for vanilla JS but they are not mantained or do not have all the features.

These components are being built for the Reacts and Vues frameworks these days.

bapetel|2 years ago

Yep, plugins in JQuery world are really consolidated and mature

valrix|2 years ago

You probably should not use jQuery unless you have an actual need for it. 10-ish years ago it was helpful because browser features were very fragmented at the time and it was hard to write code that would correctly function across all major browsers. Today, there's little difference (mostly due to them all being the same under-the-hood nowadays) so instead of being a helpful tool, it's being overused for numerous reasons. Most of what jQuery was really good at has now been added to Javascript core or there is a browser API for it.

bapetel|2 years ago

But if I work on legacy projects, I have to know JQuery

gregjor|2 years ago

Mainly because so much jQuery already out there. For a fresh project it's harder to make an argument for it, but if you work with legacy code you probably have to know jQuery.

Personally I like jQuery. Like so many developers I started using it a long time ago because it solved numerous browser inconsistencies and incompatibilities. Then I got used to the clean and concise syntax. Now I use htmx more than jQuery.

bapetel|2 years ago

For fresh project, maybe it's better to use a modern tool