How can the style/class of an element be changed?

#2
To change all classes for an element: To alter all absolute classes with one or added new classes, set the className attribute: document.getElementById("MyElement").className = "MyClass"; (You can use a space-delimited account to administer assorted classes.).
 
Top