Answers for "how to remove a class from an element in javascript and add another"

2

es6 add and remove class

let el = document.getElementById('container');

//remove class
el.classList.remove('first');

//remove class
el.classList.add('first');
Posted by: Guest on September-01-2020
1

javascript remove single class from element

yourElement.classList.remove('yourClass');
Posted by: Guest on June-02-2021

Code answers related to "how to remove a class from an element in javascript and add another"

Code answers related to "Javascript"

Browse Popular Code Answers by Language