How to use jquery.index() when looking for class
<p>I have this simple use of <a href="http://api.jquery.com/index/" rel="nofollow">jquery.index()</a> meant to return the value of an element having a class:</p>

<p>The HTML:</p>

<pre><code>&lt;ul&gt;
  &lt;li&gt;foo&lt;/li&gt;
  &lt;li class='on'&gt;bar&lt;/li&gt;
  &lt;li&gt;roo&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>The JS:</p>

<pre><code>var idx = $('li').index('.on'); 
</code></pre>

<p>It returns <code>-1</code> if the class is on any element <strong>except the first one</strong>. What am I missing?</p>

<p><a href="http://jsfiddle.net/R6mjG/" rel="nofollow">JSFIDDLE</a></p>
