append a class in javascript code example
Example 1: js append class
function myFunction() {
var element = document.getElementById("myDIV");
element.classList.add("mystyle");
}
Example 2: javascript add class to element
var someElement= document.getElementById("myElement");
someElement.className += " newclass";//add "newclass" to element (space in front is important)