title: Cannot Cannot read property 'addEventListener' of null when using innerHTML
body: <p>I am using innerHTML to add some elements and wrapper on top of it</p>
  
  <pre><code>for (i = 0; i &lt; arr.length; i++) {
      b.innerHTML += "&lt;div class='wrapper'&gt;&lt;div class='col-4'&gt;" + arr[i].storeID + "&lt;/div&gt;" + 
              "&lt;div class='col-4'&gt;" + arr[i].Bookid + "&lt;/div&gt;" + 
             "&lt;div class='col-4'&gt;" + arr[i].StoreName + "&lt;/div&gt;" + "&lt;/div&gt;"
              var d=document.querySelector('.wrapper')
              d.addEventListener("click", function(e) {
                  console.log('on click fired')
                  /*insert the value for the autocomplete text field:*/
                  inpStr=this.innerHTML
                  inp.value = this.innerHTML
                  /*close the list of autocompleted values,
                  (or any other open lists of autocompleted values:*/
                  closeAllLists();
  
              });
  }
  </code></pre>
  
  <p>The <code>innerHTML</code> is working as expected but when I click the <code>wrapper</code> row, I get</p>
  
  <blockquote>
    <p>Cannot Cannot read property 'addEventListener' of null when using
    innerHTML</p>
  </blockquote>
  
  <p>Is this because I am using innerHTML to create an element?</p>