Whats the quickest way to get the position of a node in its parent, i dont mean the physical position, i mean the index order....
So if you have:
and then are given
I know it's fairly easy to code, im just wondering what the quickest way possible is.
Cheers
Andy
So if you have:
Code:
<div id="theparent">
<div id=adiv>something</div>
<div id=anotherdiv>something</div>
<div id=divtrois>something</div>
<div id=mydiv>something</div>
</div>
and then are given
Code:
alert(getDivIndex(document.getElementById('anotherdiv'))); //returns 2
alert(getDivIndex(document.getElementById('mydiv'))); //returns 4
Cheers
Andy
Comment