I started building websites in 2008, and later that year (or maybe early 2009) I started using jQuery for the first time. For a beginner, jQuery did more than just make building things easier—it made things possible that I was simply not capable of building before. I loved jQuery, and I didn’t even learn about
$.ajax until much later (I was still doing all of my XHR by hand in a very ugly way, with ActiveX fallback for Internet Explorer).
Years passed and a lot of jQuery’s functionality has become native. One of jQuery’s most powerful tools, the sizzle selector, is now available as
document.querySelectorAll. DOM nodes now have a
classList property, with
toggle methods. CSS can do amazing things with animation (see also CSS transitions). Promises are native and the fetch API makes AJAX much easier to work with. All of this jQuery inspired native functionality has inspired some developers to proclaim that you might not need jQuery. I, too, had been seriously considering removing jQuery from my development toolbox until a recent experience.
jQuery Just Works
On a project I was working on I needed to get the distance from the top of an element to the top of the page. My original approach was to sum up all of the
offset). It worked perfectly, in all browsers. I shouldn’t have been surprised—I’ve had the “it just works” experience with jQuery so many times in the past—but I was surprised. I was surprised to learn that I might still need jQuery, and I was surprised to realize that I might always need jQuery. Because jQuery just works—every method in every browser—and it does pretty much everything you might want or need to do with the DOM.
jQuery Is Thoroughly Documented
The web has changed a lot since jQuery was first released in 2006, but still, you might (always) need jQuery.