Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript set class of element

To change all classes for an element:
To replace all existing classes with one or more new classes, set the className attribute:

document.getElementById("MyElement").className = "MyClass";
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #set #class #element
ADD COMMENT
Topic
Name
3+1 =