yuse toggle class to show and hide a button code example
Example: toggle element javascript
document.querySelector("#test").hidden = true;
document.querySelector("#test").hidden = false;
document.querySelector("#test").hidden = true;
document.querySelector("#test").hidden = false;