javascript all item that have a class will be change code example
Example 1: change elements class javascript
document.getElementById("MyElement").classList.add('MyClass');
document.getElementById("MyElement").classList.remove('MyClass');
if ( document.getElementById("MyElement").classList.contains('MyClass') )
{
document.getElementById("MyElement").classList.toggle('MyClass');
}
Example 2: javascript change element class
//Overwrite all classes
element.className = "class";
//Add class
element.classList.add("class");