jQuery getting element index despite wrapper / parent element?
<p>I have divs with same class, but each 3 are wrapped in a parent div. I can't get the index the way I want it. I am sorry, could anyone help me to get the index as number from 0 to 8.. when i click on any element? despite the parent element.</p>

<p>Here is my full code for your testing.</p>

<pre><code>&lt;div class="more-content"&gt;
    &lt;div class="post"&gt;post 1&lt;/div&gt;
    &lt;div class="post"&gt;post 2&lt;/div&gt;
    &lt;div class="post"&gt;post 3&lt;/div&gt;
&lt;/div&gt;
&lt;div class="more-content"&gt;
    &lt;div class="post"&gt;post 4&lt;/div&gt;
    &lt;div class="post"&gt;post 5&lt;/div&gt;
    &lt;div class="post"&gt;post 6&lt;/div&gt;
&lt;/div&gt;
&lt;div class="more-content"&gt;
    &lt;div class="post"&gt;post 7&lt;/div&gt;
    &lt;div class="post"&gt;post 8&lt;/div&gt;
    &lt;div class="post"&gt;post 9&lt;/div&gt;
&lt;/div&gt;

&lt;script type="text/javascript"&gt;
$(function() {

    // navigate posts with next/prev buttons
    $(".post").click(function(){
        alert($(this).index());
    });

});
&lt;/script&gt;
</code></pre>

<p>If i click i get index 0, 1, 2 ..i think because each 3 items are wrapped in parent? I am new with jquery, any help appreciated. what i need is get the index of post with same class.. say post 6 = index 5.. and so on</p>

<p><strong>UPDATE
How can I get the same result if the clicked element is a child anchor in the post div and not the post div directly?</strong></p>
