Removing jQuery From Your Project With JavaScript: Part 1

Learn to replace the jQuery DOM operation with JavaScript Photo by Sagar Patil onย Unsplash The reasons for removing jQuery are: To get native performance To understand whatโ€™s happening inside jQuery functions so we can decide whether we go for jQuery or JavaScript Part 1 of this series only focuses on getting elements without using jQuery. …

Javascript Equivalent method for jQuery addClass method.

The jQuery addClass method will add the class provided to the element or elements. Consider that we have an โ€œdivโ€ element stored in the variable โ€œdivElementโ€ย . <div id = “divElement”> </div> <script> let divElement = document.getElementById(‘divElement’)</script> now we can add class to the โ€œdivElementโ€ in JavaScript by function addClass(element, className) { divElement.classList += ” className”; …

Design a site like this with WordPress.com
Get started