"Which child of its parent am I?" in JQuery
I have the html code:
<div id="all">
<div id="1">
<div id="1-1">
</div>
<div id="1-2">
</div>
</div>
<div id="2">
<div id="2-1">
</div>
</div>
</div>
I have somewhere in my JQuery code:
var obj = jQuery("#1-2");
I want to check which child of his parent (relative to his parent) is obj
(in that case it should return 1 for second index).
I have tried (with no result):
alert(obj.index());
No comments:
Post a Comment