I want make appear/disappear table in my page. I will click the button and it will show up and then i will click the same button again and it will disappear.
Js code:
function showtable1() {
var x = document.getElementById('table1');
if (x.style.display = 'none') {
  x.style.display = 'block';
} else {
 x.style.display = 'none';
}
}
css code:
#table1 {
    width: 64%;
    height: 80%;
    border: 2px solid red;
    border-radius: 12px;
    margin-left: auto;
    margin-right: auto;
    margin-top: -10%;
    transform: translate(0);
    display:none;
    background-color: rgba(247, 243, 243, 0.849);
}
Its appearing but when i trying to disappear its not working.
 
    