To remove a class from an element, you use the remove()
method of the classList
property of the element.
Suppose you have a <div>
element as follows:
<div class="primary visible info">Item</div>
To remove the visible class from the div element, you use the following code:
const div = document.querySelector('div');
div.classList.remove('info');
The remove()
method also allows you to remove multiple classes at once, like this:
const div = document.querySelector('div');
div.classList.remove('info','primary');
Source
https://www.javascripttutorial.net/remove-class-from-an-element/