how to add class to button in javascript

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

Also in JavaScript: