Is there a method in jQuery that will traverse up the dom tree from an element and check selectors before its parent element
<p>For example:</p>

<pre><code>&lt;div class="mainWrapper"&gt;
    &lt;div class="FirstLayer"&gt;
        &lt;input class="foo" value="foo" /&gt;
    &lt;/div&gt;

    &lt;div class="SecondLayer"&gt;
        &lt;div class="thirdLayer"&gt;
            &lt;input class="fee" /&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Lets say I have the <code>input.fee</code> as a jQuery object and I also need to get the value of <code>input.foo</code>.
Now I know I can use a multitude of approaches such as <code>$(this).parents(':eq(2)').find('.foo')</code> but I want to use this one method on layouts which will have varying levels and numbers of nodes.
So I am wondering if there is a method which will simply start from <code>.fee</code> and just keep going up until it finds the first matching element, <code>.prevAll()</code> does not appear to do this. There are many <code>.foo</code> and <code>.fee</code> elements and I need specifically the first one above the <code>.fee</code> in context.</p>
