Noob question: Isn't this what jQuery is for? Is it needed if this is all that easy in vanilla JavaScript? Or is it more for using fine-grained selectors?
Originally jQuery both simplified and normalized what, at the time, was a fairly fractured DOM API, especially given Internet Explorer and its many iterations. As standards started to take hold, consistency was more prevalent and we got new APIs that allowed us to have the same functionality that jQuery provided out of the box (namely querySelectorAll) making jQuery less necessary. For the most part everything you can do in jQuery you can do with vanilla Web APIs, though the jQuery equivalent will probably be a little shorter to write. For comparisons, see: https://youmightnotneedjquery.com/
6
u/Foaric Jan 05 '23
Noob question: Isn't this what jQuery is for? Is it needed if this is all that easy in vanilla JavaScript? Or is it more for using fine-grained selectors?