jQuery Turns 20 (original) (raw)

Last week, jQuery v4 was officially released, almost two years after its beta was announced and 20(!) years after John Resig revealed it to the public. This latest version contains a slew of updates — e.g., dropping support for IE 10 and older, removing deprecated APIs — that modernize the code and reduce its size. (Minified, jQuery v4 weighs in at just under 80 KB compared to v3.7.1’s 88 KB, while the “slim” build, which removes AJAX and animation support, weighs in at a mere 56 KB.)

Even though JavaScript frameworks like React and Vue are all the rage these days, jQuery remains incredibly popular. Indeed, there was a time when I installed jQuery by default on every single website that I built, just in case I needed some DOM manipulation or fancy animations. That’s no longer the case, though, as I’ve become more comfortable with writing vanilla JavaScript sans any framework. Even so, jQuery still has its place.

Case in point: I was recently trying to develop some animations for toggle-able form fields (i.e., form fields that appear when another form field is checked or selected). I spent hours wrangling with the JavaScript, which got increasingly convoluted as my seemingly simple animation generated timing issues and race conditions. Although I’d created something very similar using jQuery several years before, I was dead-set on achieving it with vanilla JavaScript this time around. Try as I might, though, I just couldn’t get it right.

Finally, after spending two days on the issue, during which my JavaScript ballooned to 50+ lines with no end in sight, I threw up my hands and installed jQuery v4 — and was able to create the effect I wanted using just four lines of jQuery code. If I hadn’t been so happy with the results, I might’ve smacked myself upside the head for wasting so much time. (jQuery’s motto is “Write less, do more,” and they ain’t kidding.)

Now, that’s not to say that a vanilla JavaScript solution for my problem doesn’t exist, and maybe when I have more time, I’ll try to find it. And yes, I’ve added an 80 KB library and introduced another dependency to my project. Still, jQuery came through in a pinch, did precisely what I needed it to do, and let me get on with my life and the rest of the project. Which is something it’s been doing for 20 years now — an impressive feat in the constantly changing world of web development — and I wish the jQuery team another 20 years of similar success.