try this,
document.querySelector("button").addEventListener("click", changeDiv);
function changeDiv(){
var element = document.getElementById("element1");
element.style.display = (element.style.display == 'none') ? 'block' : 'none';
}
#element1{display:block}
<div id="element1">Sample</div>
<button>Click here</button>
2
solved if display is block change it to none with javascript