title: getElementsByClassName in ie8
body: <p>I'm trying to create a collapsable list in Internet Explorer 8 for the HTML I have:</p>
  
  <pre><code>&lt;li&gt;
   &lt;a href="#" onclick="test('node1')"&gt;hello&lt;/a&gt;
   &lt;ul id="node1" class="node" style="display:none"&gt;
     &lt;li&gt;Sub-item 1&lt;/li&gt;
     &lt;li&gt;Sub-item 2&lt;/li&gt;
   &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
   &lt;a href="#" onclick="test('node2')"&gt;test&lt;/a&gt;
    &lt;ul id="node2" class="node" style="display:none"&gt;
     &lt;li&gt;Sub-item 1&lt;/li&gt;
     &lt;li&gt;Sub-item 2&lt;/li&gt;
   &lt;/ul&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>in javascript i have</p>
  
  <pre><code>function test2(className, link) {
   var e = document.getElementsByClassName(className);
  
   for (var i = 0, len = e.length; i &lt; len; i++) {
     e[i].style.display = "none";
    }
  
    link.innerHTML = "Expand";
   }
  </code></pre>
  
  <p>I'm using this to call it:</p>
  
  <pre><code>      &lt;a href="#" onclick="test2('node', this)"&gt;Collapse&lt;/a&gt;
  </code></pre>
  
  <p>Unfortunately, this method is not working in IE8, and neither is <code>querySelectAll</code>.  Can someone provide an example how to fix this please?</p>