Ok I am really desperate now. I cant figure out how to get the index of a clicked div class in relation to the entire document.
Assuming I have a structure like this:
<div class="hello"> <div class="world">0ne</div> </div> <div class="hello"> <div class="world">Two</div> </div> <div class="container"> <div class="world">Three</div> <div class="anotherContainer"> <div class="world">Four</div> </div> </div> <div class="world">Five</div> How would I get the index of the second "world" class but in relation to the entire document / body. So no matter where the target is inside, I would always get the proper index.
Right now it works in relation to the parent but that is pretty much all:
https://jsfiddle.net/btkyu8wr/2/
So how could I solve this? I am trying to figure out what im missing out.