how to get class name from DOM nodes code example
Example 1: javascript change element class
//Overwrite all classes
element.className = "class";
//Add class
element.classList.add("class");
Example 2: element.classname javascript
let el = document.getElementById('item');
if (el.className === 'active'){
el.className = 'inactive';
} else {
el.className = 'active';
}