title: Javascript reveal text onclick and then close all on next click
body: <p>This code allows me to click a link and have a piece of text revealed for each and then if I click the same link, the same text gets hidden again.</p>
  
  <pre><code>   function reveal(id) {
     var e = document.getElementById(id);
     if(e.style.display == 'inline')
        e.style.display = 'none';
     else
        e.style.display = 'inline';   
  }
  </code></pre>
  
  <p>But what I want is when I click again for ALL the previously revealed text to be hidden.</p>