 <p>You can get the index like so:</p> <pre><code>$("#eq &gt; span").each(function (index, Element) { alert(index); ... </code></pre> <p>see <a href="http://api.jquery.com/each/" rel="nofollow noreferrer">http://api.jquery.com/each/</a></p>