SyntaxFix
Write A Post
Hire A Developer
Questions
you could use setAttribute.
setAttribute
Example: For adding one class:
document.getElementById('main').setAttribute("class","classOne");
For multiple classes:
document.getElementById('main').setAttribute("class", "classOne classTwo");