Answers for "html how to hide and show multiple"

0

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>
Posted by: Guest on December-06-2020
0

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";
    }
}
Posted by: Guest on December-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language