onclick(hide/show)

by damir aushenov

HTML

<div id="one"></div>
<div id="two"></div>

CSS

div {
    width: 300px;
    height: 200px;
    background: red;
    margin: 10px;
}

JavaScript

document.getElementById("one").onclick = function(){ 
    if (document.getElementById("one").click) {
        document.getElementById("two").style.display = "block";
    }else {
        document.getElementById("two").style.display = "none";
    }
};
document.getElementById("two").style.display = "none";