title: Chrome extension: Click Event Listener won't initiate
body: <p>I'm working on a Chrome extension and I have an error that gets returned whenever I try to add a &quot;click&quot; event to a class.</p>
  <blockquote>
  <p>Error in event handler for 'undefined': Object #&lt;NodeList&gt; has no method 'addEventListener' TypeError: Object #&lt;NodeList&gt; has no method 'addEventListener'</p>
  </blockquote>
  <p>Here's my code for the function (popup.js):</p>
  <pre><code>listElements: function(elements) {
      iHTML = '';
      for (var i = 0; i &lt; elements.length; i++) {
          ...
          ...
          iHTML += '&lt;div class=&quot;theBtn&quot;&gt;btn&lt;/div&gt;';
          ...
          ...
      }
  
      $('popup_content').innerHTML = iHTML;
  
      var btnElements = document.getElementsByClassName('theBtn');
      if (btnElements.length &gt; 0) {
          btnElements.addEventListener(&quot;click&quot;, clicked);
      }
  }
  </code></pre>
  <p>I also tried <code>each()</code> and that didn't work either. Same error message. It logs <code>btnElements</code> perfectly fine too. Any ideas?</p>