jquery - traverse up tree and find elements with specified class
<p>I thought that the closer() function would do this for me, but seemingly not. I have the following markup and I want to add a class to all parent anchors with the class trigger:</p>

<pre><code>    &lt;ul&gt;
    &lt;li class="selected"&gt;
      &lt;a class="trigger" href=""&gt;&lt;/a&gt; 
      &lt;a href=""&gt;&lt;/a&gt;
      &lt;ul&gt;
        &lt;li class="selected"&gt;
          &lt;a class="trigger" href=""&gt;&lt;/a&gt; 
          &lt;a href="" id = "my_target"&gt;&lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
</code></pre>

<p>I want to select my target - in this example, the deepest anchor, then add a class to each a.trigger in its ascendants. What would be the best way to do this? Thanks.</p>
