Earlier quoted context omitted.
Conversely, looking at how you do it through jQuery after seeing how it is in Javascript gives me the same reaction. The fact that jQuery is usually assigned to the dollar sign definitely doesn't help, especially for beginners. The amount of questions I've answered that stemmed from a fundamental misunderstanding of how Javascript works, all because they learned jQuery instead of Javascript, is pretty significant.
I remember when I was in uni that the $() must've had a special meaning or something. I was pretty convinced that the $ was some tough mathematical operator or computer science concept that I didn't yet understand. When I learned that it was simply a function invocation that returned a jQuery object so you could chain it, I was absolutely shocked about the simplicity of that statement. Beginning developers sure like…
jQuery 3.6.0
71–80 of 292 posts
Re: jQuery 3.6.0
#72Do 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…
> This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Have you actually compared the two methods in a real website? It's like saying why use Ruby when you can use Java. The Javascript document API is super verbose. No thanks.
Re: jQuery 3.6.0
#73Do 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…
Re: jQuery 3.6.0
#74Earlier quoted context omitted.
Please elaborate about toString() ?
If called on a Function it returns the source of the function, which allows for all sorts of meta programming.
To be honest, I don’t know that there’s ever a good reason to use it in production as it almost always involves performance and security problems.
Re: jQuery 3.6.0
#75Earlier quoted context omitted.
> This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Have you actually compared the two methods in a real website? It's like saying why use Ruby when you can use Java. The Javascript document API is super verbose. No thanks.
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.
Another jQuery advantage is pseudo-selectors which don't exist in CSS.
There are plenty of convenient one-liners in jQuery which will expand to plenty of lines in native API. That said, with modern API and JS features it's not that bad either.
Re: jQuery 3.6.0
#76Earlier quoted context omitted.
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…
> When you just want to add a small bit of interaction to a mostly-static site Then I'd reach for Alpine. Very lightweight, and I can use the fetch API instead of $.ajax.
Re: jQuery 3.6.0
#77Re: jQuery 3.6.0
#78Do 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…
Re: jQuery 3.6.0
#79Do 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…
When you have a vast, mature ecosystem and a decade and a half of community knowledge to draw upon, even the most obscure use cases tend to have a precedent somewhere. Being able to jump right to a StackOverflow answer to exactly what you're trying to do is, in my opinion, a highly underrated feature of legacy web technology.
Re: jQuery 3.6.0
#80Do 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…
Ironically, http://youmightnotneedjquery.com/ makes a pretty good case in favour of jQuery.