1/1

Add or remove class from an element

Add a class to an element

ele.classList.add('class-name');

Remove a class from an element

ele.classList.remove('class-name');

Toggle a class

ele.classList.toggle('class-name');

Might be useful

    Follow me I love building products!

    © 2020 Gandharv kumar garg. Unless otherwise noted, all code is free to use under the MIT License.