toggleclass javascript and toggle() code example
Example: classname toggle js
document.getElementById('myButton').onclick = function() {
this.classList.toggle('active');
}
document.getElementById('myButton').onclick = function() {
this.classList.toggle('active');
}