Removes a class from an HTML element.
Element.classList
and DOMTokenList.remove()
to remove the specified class from the element.const removeClass = (el, className) => el.classList.remove(className);
removeClass(document.querySelector('p.special'), 'special');
// The paragraph will not have the 'special' class anymore
JavaScript, Browser
Removes all attributes from an HTML element.
JavaScript, Browser
Checks if the given element has the specified class.
JavaScript, Browser
Adds a class to an HTML element.