JQuery: .index() returns -1
<p>Here's main part of html:</p>

<pre><code>    &lt;div id="table"&gt;
    &lt;div class="table_item"&gt;asd&lt;/div&gt;
    &lt;div class="table_item"&gt;asd&lt;/div&gt;
    &lt;div class="table_item"&gt;asd&lt;/div&gt;
    &lt;/div&gt;
</code></pre>

<p>And JS (JQuery): </p>

<pre><code>$(document).ready( function()
{
    $(".table_item").click( function()
    {
        alert($("#table").index($(this)));
    });
});
</code></pre>

<p>click handling works but I ALWAYS get -1 from .index.</p>

<p>trying simply <code>$(this).index();</code> shows the same result. </p>

<p>Please help! What's wrong with the code?</p>
