There is such a construction:
<span onclick="toggle(document.getElementById('hide1'))">Кнопка 1</span> <div id="hide1"> Блок 1 </div> and
<span onclick="toggle(document.getElementById('hide2'))">Кнопка 2</span> <div id="hide2"> Блок 2 </div> And such a JS:
function toggle(it) { it.style.display=(it.style.display=="none")?"block":"none"; } Many such buttons are planned. How can I realize the ability to turn off the old one with each new open div?