We can change the class of an element in javascript using
document.getElementById("element").class = "new Style";
We don’t need to use style.attribute name. We can also change the style using, style property
document.getElementById("element").style.color="red";