how to add class to button in javascript
snippet in javascript

how to add class to button in javascript

user4063

var element = document.getElementById("myDIV");
element.classList.add("mystyle"); 

javascript add class to element

user7370

var someElement= document.getElementById("myElement");
    someElement.className += " newclass";//add "newclass" to element (space in front is important)