Here, I have parent div of class = "alphabets" and have child div's all with same class = "word"
<div class="alphabets">
<div class="word"> abc </div> //1st child
<div class="word"> def </div> //2nd child
<div class="word"> ghi </div> //3rd child
<div class="word"> jkl </div> //4th child
<div class="word"> mno </div> //5th child
</div>
what I need is When I clicked on 'jkl'. fun() should return its index i.e whether it is 1st child or 2ndchild or 6th child...
You can use
indexOfon thechildren(after converting it to an array) of the parent element.