CodePen

HTML

            
              <html>
<head>
    <title>Test</title>
</head>

<body>
    <a href="#" onclick="toggle_visibility('targetDiv');">Test</a>

    <div id="targetDiv"><img src=
    "http://www.cssplay.co.uk/graphic/pc2.gif"></div>
</body>
</html>
            
          
!

CSS

            
              #targetDiv {display:none;}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
               function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
   }
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................