title: Get index of parent div from child divs
body: <p>I have a few divs and inside them I have nested divs. I would like to be able to get the index of the parent div my child divs reside in. Ie: If I clicked "post5" I would get the index1 or If I clicked "post4" it would still get index 1.</p>
  
  <p>Html:</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;
  </code></pre>
  
  <p>Jquery:</p>
  
  <pre><code>$(".post").click(function() {
      alert($(".post").parent.index(this));
  });
  </code></pre>