A funny thing happened to me on the way to an internet forum.

a year ago

Latest Post As The CRO Flies (Part 1) by Tracy Parks public

Funny Story...

I happened to be working - as I normally do - when my co-worker pinged me about "what to do if the site didn't have jQuery". Now jQuery, to me, is something that is just no longer needed and even when it was "needed" it really only made things easier and wasn't actually a requirement. However, it was a crutch for so long that people became dependent upon it and didn't know what to do if it wasn't present on a site.

Much of what I do is front end and client side, meaning it is wholly dependent upon what the end user's browser could do. If the site didn't have jQuery, then you cannot use jQuery. So, I learned DOM manipulation the "hard way": I always assumed jQuery wasn't present.

I showed my co-worker some basic JavaScript equivalents, but he couldn't get his head wrapped around it. So I had an Archimedes moment and said try this snippet and then use the _$ in place of $ or jQuery.

const _$ = (e) => { return document.querySelectorAll(e) };

From there I just showed him to add a for in front of the usual jQuery use of each to drill down into everything, to use style over css, classList.add() over addClass, etc. For the most part, that worked for him. He was so used to just using $('selector') to do anything it was causing him to panic or at least cause a mental block to move past jQuery and learn JavaScript.

Now with ES6+ and all the more modern sites, I have seen the use and the need to use jQuery on the rapid decline. Thankfully. Although, now that I see this snippet that I tossed out for "ease of use" and education, I see a potential to utilize it in place of writing out document.querySelector() or querySelectorAll() all over the place...

Tracy Parks

Published a year ago