title: Removing a link that contains particular text
body: <p>I'm building a glossary page. I have a list of each letter of the alphabet at the top of the page, linking via anchor text to the correct section of content. 
  I want to remove the link from the letter if the letter has no terms. </p>
  
  <p>I'm not getting any errors, but the code is not removing the link, or having any affect as far as I can tell. </p>
  
  <p>Trying to remove link for B</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 removeLink (){
  
          var letternavcontent = document.getElementById("letternav").innerHTML;
          var letter = document.getElementsByClassName("letter");
  
           if ( letternavcontent.indexOf('B') &gt; -1) {
           letter.removeAttribute("href");
           }
           }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>        &lt;p id="letternav"&gt;| &lt;a class="letter" 
          href="/glossary.html#a"&gt;A&lt;/a&gt; | &lt;a class="letter" 
          href="/glossary.html#b"&gt;B&lt;/a&gt;&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>