javascript - How to find the position for an element in a li with jquery or vanilla js -
lets imagine have following html code.
i need find position within li elements li has class focus applied.
in example result should 2 (if @ 0 index). idea how it?
<ul class="mylist"> <li>milk</li> <li>tea</li> <li class="focus">coffee</li> </ul>
Comments
Post a Comment