Alternate Vanilla Javascript to use instead of jQuery

For quite a some time I was thinking to drop-out Javascript Libraries (like: jQuery, Yahoo User Interface(YUI), Alloy User Interface(AUI), MooTools…). But I was not sure that each browser supports the javascript code the same way or not. As we know that all browsers are interpreting the script slight differently. Particularly, I was not sure about IE8/ IE9 and js libraries were & are helping us to cop-up with these browsers.

But now with latest IE & other browsers and with newer versions of Javascript. It is now possible to use vanilla javascript for the websites with basic javascript functionalities.

Comparison jQuery & Vanilla Javascript

To target DOM on page; in jQuery we’re using $(“element”) .
With vanilla javascript we can do the same with document.querySelectorAll(“element”) .

To find any elements within any section on page; in jQuery we’re using $(“.parentElement”).find(“.childElement”) .
With vanilla javascript we can do the same with document.querySelectorAll(“.parentElement .childElement”) .

Recently, I came across a site with a list of almost all the alternate functions. It has vanilla javascript’s function which can be use as alternate functions and might be very helpful for us to use it for mostly targeting/manipulating DOM and AJAX requests.

It is advisable not to use jQuery if you’re suppose to only target/manipulate DOM and little bit of AJAX requests in your project. We can do these operations easily & effectively with vanilla javascript and by dropping out extra javascript libraries you’ll save your website from burden of extra bytes.

Benefits of dropping-out jQuery

  • It will make your page load faster and save few KBs (specially on slow networks on devices).
  • It will improve UI performance and responsiveness on devices.
  • By removing jQuery you’ll get to know Vanilla Javascript, browser APIs, in-short it will help us understand DOM & browsers more deeply.

Though, I am quite positive to use jQuery but it is always worth to know what we require in project and select libraries accordingly.

Et voilà!!!
Do let me know what you think about this article in the comment box below.

Web/ UI & Front-end developer based in Ahmedabad, GJ, India. Here to help/ discuss community to spread web awareness.

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.