Source Code:
Click the list items to get the index position, relative to its sibling elements
Coffee
Milk
Soda
Result:
W3Schools.com
- Try it yourself