hide div when click button code example
Example 1: html button that hide and show
<button onclick="toggleText()">button</button>
<p id="Myid">Text</p>
<script>
function toggleText(){
var x = document.getElementById("Myid");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
Example 2: js hide div
//If you have jquery, you can use the following method:
$("#mydiv").hide(); //hides div.
$("#mydiv").show(); //shows div.
//If you don't have jquery...
//search up the following: html how to add jquery