title: How to use querySelector to select this element
body: <pre><code>&lt;div class="parentDiv" &gt;
     &lt;button class="close" 
      data-dismiss="modal" 
      style="..." 
      aria-label="Close" 
      onclick='$(this).closest(".parentDiv").remove()'
      &gt;
           &lt;span class="glyphicon glyphicon-remove-circle small"&gt;&lt;/span&gt;
      &lt;/button&gt;
  
      &lt;div class="alert alert-danger"&gt;{{ errorMsg }}&lt;/div&gt;
  &lt;/div&gt;
  ...
  ...
  </code></pre>
  
  <p>In the above sample code, what strategy can I use to change the jQuery $(this) to pure javascript code like using querySelector?</p>
  
  <p><em>Please note that I want to use Element.closest() because there will be many Div elements stacked on top of each other having "parentDiv" class name.</em> </p>
  
  <p>Basically, I want to select the parent and then remove that node after the cick on $(this) element.</p>
  
  <p>So what's the best approach for doing this without using jQuery selector like <strong>$(this).closest('.parentDiv').remove()</strong> ? </p>
  
  <p>And is it possible to do it without knowing the class name or ID of the current (this) element ?</p>