Re:jQuery 4.1.0
by petre on Tuesday November 17, 2026 @04:04PM
(#50538157)
Go ahead, use document.querySelector. Why? Because chaining and a bunch of other stuff and not bothering to check if querySelector actually got anything every single time.
[ Parent
| on HN ]
There's a purpose for everything. Jquery is quite nice to write and works great. For a whole site, I'd these days be interested in building with HTMX, but JQ is fine and has the advantage that there are millions of people out there who know it well.
What vanilla is obviously unbeatable for is, you're writing a snippet of JS that you can hand anyone[1] to run with no dependency requirements. Some codebases may be explicitly incompatible with JQ, so knowing how to do all the JQ basics "vanilla" is an important skill so you don't have to bring in a "big" (relatively, I mean) library to support a 7-line function.
[1] for example, an embed code, an analytics tag, or a script to customize the markup on a page.