从子div获取父div的索引

我有几个div,在里面我有嵌套的div。 我希望能够得到我的孩子div所在的父div的索引。即:如果我点击“post5”我会得到index1或如果我点击“post4”它仍然会得到索引1。

HTML:

post 1
post 2
post 3
post 4
post 5
post 6
post 7
post 8
post 9

jQuery的:

 $(".post").click(function() { alert($(".post").parent.index(this)); }); 

以下应该有效:

 $(".post").click(function() { var index = $(this).parent().index(".more-content"); alert(index); }); 

演示: http //jsfiddle.net/NDySY/