function button1() {
    document.getElementById("id1").style.visibility = "hidden";
}.d1 {
    font-family: "Aldrich";
    font-size: 50px;
}<link href="https://fonts.googleapis.com/css?family=Aldrich" rel="stylesheet">
<div class="d1" id ="id1">Test</div>
<button onclick="button1">Button 1</button>I use the above simple code to set the visibility of a div to hidden via a button. I click on it but nothing happens. If I set the property visibility: hidden; directly to d1 it does work though...
 
     
     
    