get classname javascript code example
Example 1: javascript get class name
document.getElementById("myDIV").className = "mystyle";
Example 2: get name of class javascript
myObj.constructor.name
Example 3: element.classname javascript
let el = document.getElementById('item');
if (el.className === 'active'){
el.className = 'inactive';
} else {
el.className = 'active';
}