Finding an element in a javascript array and returning the position of the matched element
<p>I'm plucking my brain away at this but was hoping someone could help after several failed attempts.</p>

<p>I have an HTML list like this:</p>

<pre><code>&lt;ul&gt;
&lt;li&gt;&lt;span class="current"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="normal"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>I'm trying to figure out a way to find the li element in this list which has the span with the class current with the number it is at in the ul. So, in this case, it would be 1.</p>

<p>I tried using different jquery functions but I seem to be getting nowhere. This is what it looks like right now:</p>

<pre><code>var list = $('ul li');
$.each(list, function(key, value) {
    if( $(this).find('.current') ) {
        alert(key);
    }
});
</code></pre>

<p>This just alerts 0, and 1, essentially meaning that it doesn't work. Does anyone have any idea what is wrong with what I'm doing?</p>
