Do not access className
from the style
object, access it directly like
this.className
document.querySelector('button').onclick = function() {
this.className="";
}
.myClass {
color:red;
}
.second {
color:green;
}
<button id="button" class="myClass second">click me</button>