title: Cannot read properties of undefined (reading 'remove')
body: <p>how do you remove the top level parentElement of the div.  I have been trying to remove the top Parent Element of the div.</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-js lang-js prettyprint-override"><code>element.innerHTML = `
  &lt;div class="postIt-item"&gt;
      &lt;div class="postIt-item-btn-container"&gt; 
      &lt;button  class="btn-delete" type="button"&gt;&lt;i class="fa fa-trash" aria-hidden="true"&gt;&lt;/i&gt;&lt;/button&gt;
      &lt;button  class="btn-edit" type="button"&gt;&lt;i class="fa fa-pencil" aria-hidden="true"&gt;&lt;/i&gt;&lt;/button&gt;
      &lt;/div&gt;  
    &lt;p&gt; ${value}&lt;/p&gt;
  &lt;div&gt; `
  
  const deletebtn = element.querySelector('.btn-delete');
  deletebtn.addEventListener('click', deleteItem);
  
  //delete function 
  function deleteItem(e) {
  
    const element = e.currentTarget.parentElement.parentElement;
    e.parentElement.remove(); // 
  }</code></pre>
  </div>
  </div>
  </p>