<html>
  <body>
    <div id="test">
      My New Div - Some Random Stuff in the div 
    </div>
    <button onclick=someFunc()>Click Me</button>
  </body>
</html>
var ishidden = false;
function someFunc(){
  
  if(!ishidden){
    document.getElementById("test").style.visibility = "hidden";  
    ishidden = true;
  }
  else {
    document.getElementById("test").style.visibility = "visible";  
    ishidden = false;
  }
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.