title: Hide/show div content by class
body: <p>I have this code which works to hide/show div content by id. I need to change it to identify content by div class. How can I do that?</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;a href="javascript:hideshow(document.getElementById('adiv'))"&gt;Click here&lt;/a&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>function hideshow(which){
                  if (!document.getElementById)
                      return
                  if (which.style.display=="block")
                      which.style.display="none"
                  else
                      which.style.display="block"
              }
  </code></pre>