I need to find the index of an element inside its container by reference to the object. Oddly enough, I cannot find an easy way. No jQuery please - just the DOM.
UL LI LI LI - my index is 2 LI
Yes, I could assign identifiers to each element and iterate over all nodes according to ID, but this seems like a bad solution. Is there nothing better?
So, let's say I have an object reference for the third LI, as in the above example. How to find out what is index 2?
Thank.
javascript dom html parent-child
Vad Aug 01 2018-12-12T00: 00Z
source share