toggle javascript dom code example
Example 1: classname toggle js
document.getElementById('myButton').onclick = function() {
this.classList.toggle('active');
}
Example 2: toggle element javascript
document.querySelector("#test").hidden = true;
document.querySelector("#test").hidden = false;