How exactly do I get the index of e.target? IndexOf wont work and I dont want to use the Array.prototype property. So what is the best way to get the index of the target element?
Basically element is a container with a bunch of divs. If I hover over a div I want to get its index.
element.addEventListener("mouseover", someEvent, false);
function someEvent(e) {
if (e.target !== e.currentTarget) {
// get the index of the hovered element here
}
e.stopPropagation();
}
I explicitely stated that I dont want to use Array.prototype so the link is not a duplicate.
By the way, here a jsfiddle https://jsfiddle.net/nbjve593/