html how to hide and show multiple code example
Example 1: html how to hide and show multiple
<div class="hide1">One</div>
<div class="hide2">Two</div>
<a href="#" onclick="ToggleVisibility('hide1'); return false;">One</a>
<a href="#" onclick="ToggleVisibility('hide2'); return false;">Two</a>
<a href="#" onclick="ToggleVisibility('nosuchclass'); return false;">No hide</a>
Example 2: html how to hide and show multiple
function ToggleVisibility(divClass)
{
var els = document.getElementsByClassName(divClass);
for(var i = 0; i < els.length; i++)
{
els[i].style.visibility = els[i].style.visibility == "hidden" ? "visible" : "hidden";
}
}