How to make a DIV visible and invisible with JavaScript

user1163722 picture user1163722 · Feb 26, 2012 · Viewed 487.2k times · Source

Can you do something like

function showDiv()
{
    [DIV].visible = true;
    //or something
}

Answer

ron tornambe picture ron tornambe · Feb 26, 2012

if [DIV] is an element then

[DIV].style.visibility='visible'

OR

[DIV].style.visibility='hidden'