Is parentsUntil() the best function to use? Jquery
<p>Given the html:</p>

<pre><code>     &lt;div class="a"&gt;
        &lt;div class="b"&gt;
           &lt;div class="c"&gt;
             &lt;div class="d"&gt;
             &lt;/div&gt;
           &lt;/div&gt;
          &lt;div class="d"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
     &lt;/div&gt;
</code></pre>

<p>Im interested in the selecting the parent element with class <code>a</code> applied to it when any element with the class 'd' is clicked.</p>

<p>I have the following javascript / jQuery, but it seems very messy. Is there a neater way?</p>

<pre><code>&lt;script&gt;
   $('.d').click(function(){
      var elementA =  $(this).parentsUntil('.a').last().parent();    
   })
&lt;/script&gt;
</code></pre>
