title: Load content on anchor link click
body: <p>I have content that is hidden by default. On button click, I want the selected one to show its content. I.e if find more is clicked on the second <code>div</code>, show the content for that div. </p>
  
  <p><strong>Approach so far:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function showClass(a) {
    var e = [];
    var e = document.getElementsByClassName(a);
    for (elem of e) {
      if (!elem) return true;
  
      if (elem.style.display == "none") {
        elem.style.display = "block"
      } else {
        elem.style.display = "none"
      }
    }
    return true;
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.list {
    display: none;
  }
  
  a {
    cursor: pointer;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;div class="list"&gt;
    &lt;ul&gt;
      &lt;li&gt;list 1&lt;/li&gt;
      &lt;li&gt;list 2&lt;/li&gt;
      &lt;li&gt;list 3&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div class="list"&gt;
    &lt;ul&gt;
      &lt;li&gt;list 4&lt;/li&gt;
      &lt;li&gt;list 5&lt;/li&gt;
      &lt;li&gt;list 6&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div class="list"&gt;
    &lt;ul&gt;
      &lt;li&gt;list 7&lt;/li&gt;
      &lt;li&gt;list 8&lt;/li&gt;
      &lt;li&gt;list 9&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  
  
  &lt;a onclick="showClass('list');" class="loadMoreBtn"&gt;Find out more&lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Where am I going wrong?</p>