Hiding and Showing Elements with JavaScript

Posted by user1658756 on Stack Overflow See other posts from Stack Overflow or by user1658756
Published on 2012-09-09T21:36:21Z Indexed on 2012/09/09 21:37 UTC
Read the original article Hit count: 156

Filed under:
|
|

I have an arrow on my site that I'd like if onclick, it hides one element, and shows another. Hitting it again, will hide the element that was shown and show the element that was hidden.

Is that possible to do without jQuery?

For example, I have

<div id="arrow"><a href="#">?</a></div>

<div id="ad"></div>

<div id="description">Hidden</div>
<div id="nav">Also Hidden</div>

So at first, the ad is showing, and then one you've clicked the arrow, I'd like the ad to hide, and then unhide the description and nav.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery