Live data from Hacker News

Ask HN: Any Modern Alternative to JQuery?

news.ycombinator.com

21–26 of 26 posts

Re: Ask HN: Any Modern Alternative to JQuery?

#21
post #19
post #17

Earlier quoted context omitted.

You don't download an entire library to save you some keystrokes. Just create your own $ alias if you must.

It's not just $... And why not just install jQuery? What's the big deal? Where can I find the short aliased library? (If it's not there, I guess it's not a popular idea.)

jQuery does not really add value in 2020, since browsers (even the ones that are widely phased out) have standardised all of its main features.

In the last 5+ years, I have never found myself missing something from jQuery. Is there something that jQuery does marginally better than vanilla JS in 2020?

> What's the big deal?

Sending unnecessary dependencies over the wire without any justification

Re: Ask HN: Any Modern Alternative to JQuery?

#22
post #16

Vanilla JavaScript is what you need today. You can use document.querySelector, Array.prototype.map, fetch, and all browsers have the same behaviour so no need for any library like jQuery anymore.

Feature parity isn't exactly the reason to drop it.... $ is easier to type than document.querySelector and it absorbs browser differences.

$ is mapped to querySelector and $$ to querySelectorAll in just about every browser, isn't it?

$("#something").innerHTML = "Hi"; is vanilla JS.

Re: Ask HN: Any Modern Alternative to JQuery?

#26

I want to try this soon: https://htmx.org/ htmx allows you to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext htmx is small (~9k min.gz'd), dependency-free, extendable & IE11 compatible

Playing with it now, one annoyance is that it operates on names, not ids. E.g., if you have a You can't set statusbox as the hx-target and expect it to work.

I'm not sure what kind of issues you've faced with. According to documentation, you can set "#statusbox" as the hx-target and it works.

https://htmx.org/docs/#targets

Post reply on HN