Is it still necessary to use JQuery in 2023 instead of vanilla js? I always had the impression JQuery was more useful to decouple you from the pain of multi-browser development in the 2000s dark ages of browser standards adoption.
Is it still necessary to use JQuery in 2023 instead of vanilla js? I always had the impression JQuery was more useful to decouple you from the pain of multi-browser development in the 2000s dark ages of browser standards adoption.
I still use it as it’s a decent way to write succinct code to access the DOM.
Makes me laugh that the same devs that claim you should use vanillaJS and that jQuery is bad are the same ones building React sites and using whatever else the latest JS trend is!
jQuery syntax is clean, it works, why change that?
$(“.submenus”).hide()
vs let submenus = document.querySelectorAll(“.submenus”);
for (let i = 0; i < submenus.length; ++i) {
submenus[i].style.display = “none”;
} document.querySelectorAll("p").forEach(e => e.style.display = "none") for (const e of document.querySelectorAll("p")) { e.style.display = "none" } const $ = s => document.querySelectorAll(s);
const hide = e => e.style.display = 'none';
$('.submenus').forEach(hide);
or, if you're okay with changing prototypes const $ = s => document.querySelectorAll(s);
NodeList.prototype.hide = function () {this.forEach(e => e.style.display = 'none');};
$('.submenus').hide();I can’t remember the exact use case. We probably could have done it in raw JS, but jQuery made a bunch of things much easier. Since it’s a Chome extension, package size didn’t really matter.