Select Page

jQuery is a fantastic resource for developers to use to add advanced JavaScript to a project in a much more simplified way but is it necessary or even the best choice in all cases? There are times when using plain JavaScript, also called vanilla JavaScript, could be a better choice. It could also be argued that learning and using vanilla JavaScript is beneficial in itself. When you are able to understand the logic behind the skill that you know, you are able to utilize it to its fullest potential.

Computer with hands typing codeOne reason to use vanilla JavaScript instead of jQuery is to increase site performance. It takes extra time for the jQuery library to load when the page loads. By removing the library and replacing with vanilla JavaScript, you can help pages to load faster. Tim Kadlec discusses this in his blog post, Smart Defaults on Libraries and Frameworks:

I’ve worked on projects where some of the devices we needed to test on couldn’t load the page at all if jQuery was present—it was just too much JavaScript for the device to handle.

In the past, it could be very difficult to select elements with vanilla JS and jQuery makes it much simpler. It is not necessarily the case anymore with HTML5. Some of the new HTML5 functionality works much the same way as some of the best features of jQuery. Zachary Brady explains this in a blog post on Modern Web called Replacing jQuery with vanilla JavaScript:

Many of jQuery’s most useful capabilities are gradually being incorporated into vanilla JS through the steady influx of new HTML5 APIs, offering an opportunity to learn new features. When you can’t find the functionality you need in an HTML5 API, building a function from scratch is also a great way to dive into unexplored territory. is also a great resource to compare the vanilla JavaScript with jQuery to see if it is really beneficial for you to use. Sometimes it is more beneficial to use jQuery, but it is important to understand why you would need it and why you might not.