classname mdn code example
Example 1: document getelementsbyclassname not getting all elements
//use this instead
document.querySelectorAll(".myclassname");
Example 2: element.classname javascript
let el = document.getElementById('item');
if (el.className === 'active'){
el.className = 'inactive';
} else {
el.className = 'active';
}