ClassName Toggle JS
document.getElementById('myButton').onclick = function() {
this.classList.toggle('active');
}
Yucky Yak
document.getElementById('myButton').onclick = function() {
this.classList.toggle('active');
}
document.getElementById('myButton').onclick = function() {
var className = ' ' + myButton.className + ' ';
if ( ~className.indexOf(' active ') ) {
this.className = className.replace(' active ', ' ');
} else {
this.className += ' active';
}
}