вы хотите скрыть все теги div одним кликом?тогда вы можете попробовать это
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#list_one,#list_two {
width: 100%;
padding: 50px 0;
text-align: center;
background-color:#C5C5C3 ;
margin-top: 20px;
}
</style>
</head>
<body>
<p>Click the "Try it" button to toggle between hiding and showing the DIV element:</p>
<button onclick="myFunction()">Try it</button>
<div id="list_one">
<ul>
<li>Item Uno</li>
<li>Item Dos</li>
<li>Item Tre</li>
</ul>
</div>
<div id="list_two">
<ul>
<li>Item Uno</li>
<li>Item Dos</li>
<li>Item Tre</li>
</ul>
</div>
<script>
function myFunction() {
var divs = document.getElementsByTagName("div");
for (var i = 0; i < divs.length; i++) {
if (divs[i].style.display === "none") {
divs[i].style.display = "block";
} else {
divs[i].style.display = "none";
}
}
}
</script>
</body>
</html>
для одного div, попробуйте ниже javascript
function myFunction() {
var x = document.getElementById("list_one");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}