I know jquery is still in use a lot all over the web, but are people still starting new projects with it?
jQuery 3.6.0
121–130 of 292 posts
Re: jQuery 3.6.0
#122The final thing I used to reach for jQuery for was animation support, but that need is by and large gone now. AJAX/JSONP is good there, but to be honest it's not something that needs a wrapper these days.
Glad to see the library is still updated, though - for sites that might not have a budget to upgrade, knowing it's still got support must be nice.
Re: jQuery 3.6.0
#123Earlier quoted context omitted.
Your example does not work. querySelectorAll returns array and you can't write `array.classList.add("...")`, because array does not have that property. You need to iterate over that array. And that's exactly why jQuery is so much more convenient over native API: you can just treat collections of elements like an element and jQuery will iterate for you if necessary. Another jQuery advantage is pseudo-selectors which d…
querySelectorAll returns a NodeList, which is even more limited than an array (e.g. no map or filter).
Re: jQuery 3.6.0
#124Earlier quoted context omitted.
You don't have to use all of it though, right? You can choose to only only use the applicable parts: eg: ``` $('.container-element') .addClass('active'); // vs document.querySelectorAll('.my-class-selector') .classList.add('active') ``` I use the native APIs all the time, they are not that complicated or overly verbose. Easily memorized with practice IMHO. Also they are all extremely well documented on MDN.
Technically that breaks, you want: document.querySelectorAll('.my-class-selector').forEach(el => el.classList.add('active')) Personally I use the native APIs because they aren't that hard to use (most of them, anyways) and I tend to be OCD about bundle sizes, but to each their own, I suppose.
https://megous.com/dl/tmp/basic.js
1.3kB compressed. Much better. :) And I avoided having to rewrite my extensions with platform APIs. That was before FF killed all the joy in writing userscripts for me, because I was no longer able to install and update them just by copying them to mozilla folder and had to invoke a lot of clicking ceremony to just get my 20 scripts or so from git into firefox past the webextension limitations on storage/access to mozilla folder.
Re: jQuery 3.6.0
#125Re: jQuery 3.6.0
#126Do people still use jQuery? I thought the biggest advantage of this library back in the day was css selector access of DOM nodes (back when we only had getElementById, getElementsByClassName, and getElementsByTagName). This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Also there are browser compatibility issues that jQuery solved but a lot of these are so…
All the time.
> This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll.
The official replacements for the stuff jQuery does tend to be verbose and non-orthogonal, as compared to the much more unified and consistent API of jQuery.
Re: jQuery 3.6.0
#127Re: jQuery 3.6.0
#128Re: jQuery 3.6.0
#129Do people still use jQuery? I thought the biggest advantage of this library back in the day was css selector access of DOM nodes (back when we only had getElementById, getElementsByClassName, and getElementsByTagName). This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Also there are browser compatibility issues that jQuery solved but a lot of these are so…
I think a lot! For example, the new https://www.whitehouse.gov uses jQuery. When you just want to add a small bit of interaction to a mostly-static site, jQuery can help. There's a current trend to complicate things with a JAM stack that really don't need to be complicated. I've seen people propose something like [NodeJS/Ruby/PHP backend] -> GraphQL API -> React Frontend -> static html Where really they could have ju…