
Use Element.classList
and DOMTokenList.remove()
to remove the specified class from the element.
const removeClass = (el, className) => el.classList.remove(className);
// EXAMPLE
removeClass(document.querySelector('p.special'), 'special');
// The paragraph will not have the 'special' class anymore
Source
https://www.30secondsofcode.org/js/s/remove-class