finding index of element
<p>I have some HTML like this:</p>

<pre><code>&lt;div class="TopClass"&gt;

  &lt;div class="ContentClass"&gt;
    &lt;div class="ActionClass"&gt;action&lt;/div&gt;
  &lt;/div&gt; 

  &lt;div class="ContentClass"&gt;
    &lt;div class="ActionClass"&gt;action&lt;/div&gt;
  &lt;/div&gt; 

  &lt;div class="ContentClass"&gt;
    &lt;div class="ActionClass"&gt;action&lt;/div&gt;
  &lt;/div&gt; 

&lt;/div&gt;
</code></pre>

<p>I'm looking to get the index of the action class relative to TopClass; if the user clicks on the second Action class, it should return 2.</p>

<pre><code>$('.ActionClass').click(function () {
    alert($(this).parent().parent().index());  // not working    
});
</code></pre>
