Get previous LI with condition
<p>I can't get my head around this. Seems to be easy.</p>

<pre><code>&lt;ul class="steps anchor"&gt;
&lt;li&gt;&lt;a href="#step-1" class="done" isdone="1" rel="1"&gt;&lt;label class="stepNumber"&gt;1&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-2" class="disabled" isdone="0" rel="2"&gt;&lt;label class="stepNumber"&gt;2&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-3" class="selected" isdone="1" rel="3"&gt;&lt;label class="stepNumber"&gt;3&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-4" class="disabled" isdone="0" rel="4"&gt;&lt;label class="stepNumber"&gt;4&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>What I want:
I want to select the current Li (class="selected") (=3)
And then want to get the rel of the previous LI which has class="done".</p>

<blockquote>
  <p>$('ul.steps li a.selected').prev('li').hasClass('done').html()</p>
</blockquote>

<p>I am stuck thinking this way. Maybe anyone can help me in the right direction?
Thanks</p>

<p>Edit: I said Li with class="done". But that has to be an :
What I want:
I want to select the current a (class="selected") (=3)
And then want to get the rel of the previous a which has class="done".</p>

<p>Edit2:</p>

<blockquote>
<pre><code>&lt;ul class="steps anchor"&gt;
&lt;li&gt;&lt;a href="#step-1" class="done" isdone="1" rel="1"&gt;&lt;label class="stepNumber"&gt;1&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-2" class="done" isdone="1" rel="2"&gt;&lt;label class="stepNumber"&gt;2&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-3" class="done" isdone="1" rel="3"&gt;&lt;label class="stepNumber"&gt;3&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-4" class="disabled" isdone="0" rel="4"&gt;&lt;label class="stepNumber"&gt;4&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-5" class="disabled" isdone="0" rel="5"&gt;&lt;label class="stepNumber"&gt;5&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#step-6" class="selected" isdone="1" rel="6"&gt;&lt;label class="stepNumber"&gt;6&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>
</blockquote>

<p>I have updated my Li structure. Now say I am at LI 6. I want to go to the previous LI with a[class='done']. So a[rel=3]. Your anwsers always give the first LI back (1). </p>
