Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
You Might Not Need jQuery (youmightnotneedjquery.com)
17 points by belfalas on July 27, 2022 | hide | past | favorite | 11 comments


This site gets posted a lot. However if you looks the comparison code for vanilla JavaScript vs jquery, it looks like the jquery syntax is much easier to comprehend.


If the syntax for what you want to do is slightly more verbose, JavaScript has a concept of functions which allow you to reuse code quite easily:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...


You don’t even need to write your own functions: the JavaScript ecosystem has the concept of packaging functions and publishing them as useful libraries!

https://www.npmjs.com/package/jquery


Clearly posting this in 2022 is really funny, it is almost 10 year old I guess? Technically it's still interesting for improving one code style but does jQuery still heavy in use nowadays? I mean people use it, but I suppose more by choice than by default, they have to really WANT to use it.


Confession: I use it constantly. The thought of having to look up how to do absolutely everything makes me wince.

I am -genuinely- open to suggestions on how to get over that I just can’t currently justify making everything harder “for a short while” when that short while feels like it could be weeks or months to catch up to fluency.


Instead of elems = $(selector, context), use elems = […context.querySelectorAll(selector)]

Instead of $.get(), use await fetch()

Instead of .on(eventtype, handler), use elem.addEventListener(eventtype, handler)

Instead of .animate(), use CSS animations


jQuery is still nice to use, I do it sometimes these days.


Alpine JS is a great modern (spiritual) replacement for jQuery.

It provides a nice reactive, declarative API to manipulate the DOM, without going all-in on a heavy JS framework.

https://alpinejs.dev


I love jquery. Nothing else needs to be said.


*loved


2008 was just yesterday. Woah. Time has catch up with my knowledge.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: