title: ClassList does not work in IE9. need alternative function
body: <p>I am unable to run '<a href="http://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_accordion_symbol" rel="nofollow">W3Schools Accordion with symbols</a>' in IE9. ClassList does not work in IE9. It gives following error <pre>SCRIPT5007: Unable to get value of the property 'toggle': object is null or undefined 
  </pre></p>
  
  <p><strong>I am not a coder.  I need alternative function, so that I dont need to recreate my 1000 lines static HTML page.</strong></p>
  
  <p>Here is full code that I need to run in IE9 </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-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;style&gt;
  button.accordion {
      background-color: #eee;
      color: #444;
      cursor: pointer;
      padding: 18px;
      width: 100%;
      border: none;
      text-align: left;
      outline: none;
      font-size: 15px;
      transition: 0.4s;
  }
  
  button.accordion.active, button.accordion:hover {
      background-color: #ddd;
  }
  
  button.accordion:after {
      content: '\02795';
      font-size: 13px;
      color: #777;
      float: right;
      margin-left: 5px;
  }
  
  button.accordion.active:after {
      content: "\2796";
  }
  
  div.panel {
      padding: 0 18px;
      background-color: white;
      max-height: 0;
      overflow: hidden;
      transition: 0.6s ease-in-out;
      opacity: 0;
  }
  
  div.panel.show {
      opacity: 1;
      max-height: 500px;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;h2&gt;Accordion with symbols&lt;/h2&gt;
  &lt;p&gt;In this example we have added a "plus" sign to each button. When the user clicks on the button, the "plus" sign is replaced with a "minus" sign.&lt;/p&gt;
  &lt;button class="accordion"&gt;Section 1&lt;/button&gt;
  &lt;div class="panel"&gt;
    &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;button class="accordion"&gt;Section 2&lt;/button&gt;
  &lt;div class="panel"&gt;
    &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;button class="accordion"&gt;Section 3&lt;/button&gt;
  &lt;div id="foo" class="panel"&gt;
    &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  var acc = document.getElementsByClassName("accordion");
  var i;
  
  for (i = 0; i &lt; acc.length; i++) {
      acc[i].onclick = function(){
          this.classList.toggle("active");
          this.nextElementSibling.classList.toggle("show");
    }
  }
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>