Earlier quoted context omitted.
Mostly off the top of my head: document.getElementById('some-form').getElementsByTagName('input').forEach(i => i.classList.add('error')) It is a little more verbose but it isn't that much more cumbersome today. That's also doing things "the right way" and not do-all selectors, but that option exists now, too: document.querySelectorAll('#some-form > input').forEach(i => i.classList.add('error')) If you want to make it…
Love the syntax in the last example, you should make it into a library!
jQuery 4.0 99% Complete
31–40 of 47 posts
Re: jQuery 4.0 99% Complete
#32Earlier quoted context omitted.
https://youmightnotneedjquery.com/
Quite a feel of those seem like while you don't need jQuery (so the site is indeed actually named), it's still often easier. Doubly so when you consider that the non-jQuery methods don't always chain together. Admittedly I'm usually using it in places where loading the extra library is not an issue, so if you're really going for slimline, then sure.
Re: jQuery 4.0 99% Complete
#33I wonder if the footprint got smaller or bigger.
Re: jQuery 4.0 99% Complete
#34I use jQuery for JS for the same reason I use Twig for PHP.....it's way simpler to write functions to get things done. People keep telling me to switch to ES6 but I'm never upgrading. Why would I? jQuery just feels like a good pair of jeans.
Re: jQuery 4.0 99% Complete
#35Is there some kind of summary available somewhere of what features are “unique” to jQuery (or at least significantly easier), and what features are now generally available as vanilla JS or CSS? I’m not a JS developer and I just have a basic understanding of what jQuery is used for, so I’d be interested in seeing some kind of historical timeline, both to better understand why jQuery was originally created, and to unde…
Re: jQuery 4.0 99% Complete
#36Is there some kind of summary available somewhere of what features are “unique” to jQuery (or at least significantly easier), and what features are now generally available as vanilla JS or CSS? I’m not a JS developer and I just have a basic understanding of what jQuery is used for, so I’d be interested in seeing some kind of historical timeline, both to better understand why jQuery was originally created, and to unde…
https://youmightnotneedjquery.com/
Re: jQuery 4.0 99% Complete
#37Earlier quoted context omitted.
It does not matter that much, relatively speaking. People include 1MB font libraries in their site without a care in the world, and force 1-2MB PNGs and JPEGs down the wire without caring. A few extra bytes in jQuery is nothing compared to that.
Yeah. However, it does matter in interactive websites because if the js is light it'll load fast and execute fast and you'll have interactivity sooner. It may be the case that images can be loaded later or arent even visible on the home page. And fonts of course will be replaced once they are loaded and the defaults will be used while it loads so it's progressive in a way.
Re: jQuery 4.0 99% Complete
#38Earlier quoted context omitted.
It does not matter that much, relatively speaking. People include 1MB font libraries in their site without a care in the world, and force 1-2MB PNGs and JPEGs down the wire without caring. A few extra bytes in jQuery is nothing compared to that.
Yeah. However, it does matter in interactive websites because if the js is light it'll load fast and execute fast and you'll have interactivity sooner. It may be the case that images can be loaded later or arent even visible on the home page. And fonts of course will be replaced once they are loaded and the defaults will be used while it loads so it's progressive in a way.
Re: jQuery 4.0 99% Complete
#39The younglings don't seem to appreciate what a godsend jQuery was back in the day, it gave you a decent API that worked on all browsers, including IE6. HTMX nowadays is giving off a similar vibe, it gets you 95% there without modern JS insanity/complexity.
Re: jQuery 4.0 99% Complete
#40Just leaving this here since people will wonder the relevance of jQuery today. > jQuery is used by 94.5% of all the websites whose JavaScript library we know. This is 77.4% of all websites. https://w3techs.com/technologies/details/js-jquery
How many of them are WordPress installations or sites running Bootstrap?
Bootstrap does not require jQuery. Not sure if ever but not since 3.0 and were are at 5.0 at this point.