title: How to fix error: TypeError: elements.classList is undefined?
body: <p>I'm trying to add a class called "blackbackdrop" to every element that has a class called "icon" using classList.
  Unfortunately it does not work because of error <code>TypeError: elements.classList is undefined</code></p>
  
  <p>I'm using this code:</p>
  
  <pre class="lang-js prettyprint-override"><code>function blackBackDropIcon() {
    var elements = document.getElementsByClassName("icon");
    elements.classList.add('blackbackdrop');
  }
  </code></pre>