get an element position using jquery
<p>I'd like to find an element position using JQuery. Not the X and Y position using .position .</p>

<p>For exemple</p>

<pre><code>&lt;ul&gt;
    &lt;li&gt;&lt;/li&gt;
    &lt;li&gt;&lt;/li&gt;
    &lt;li&gt;&lt;/li&gt;
    &lt;li&gt;&lt;/li&gt;
    &lt;li&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>And the js</p>

<pre><code>//return the li pos
$('li').click(function(){...})
</code></pre>

<p>for exemple if I click the third li the function return the li pos witch is 2</p>

<p>I try something but it doesn't works</p>

<pre><code>$('li').click(function(){
    for(var i = 0; i &lt; $('li').length; i++){
        if($('li:eq('+i+')') == $(this)){
            alert(i);
            return true;
        }
    }
    alert('fail');
    return false;
})
</code></pre>

<p>And I always get fail</p>

<p>Thanks</p>
