How to find the index of a DOM node within its parent (as used by .childNodes)?
11:29 18 Dec 2008

I want find the index of a given DOM node. It's like the inverse of doing

document.getElementById('id_of_element').childNodes[K]

I want to instead extract the value of K given that I already have the reference to the child node and the parent node. How do I do this?

javascript dom