Finding n-th level of sibling on DOM with jquery
By clicking on an element in DOM, to get the which indexed number of the sibling, you’ll need to use jquery’s .index() method which is easy and useful too.
Let’s give an example,
HTML :
<ul>
<li>first</li>
<li>second</li>
<li>third</li>
</ul>
Javascript:
$('li').click(function () {
alert($(this).index());
});
Enjoy jquery