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