Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("li").click(function(){
    alert($(this).index());
  });
});
</script>
</head>
<body>
<p>Click the list items to get the index position, relative to its sibling elements</p>
<ul>
  <li>Coffee</li>
  <li>Milk</li>
  <li>Soda</li>
</ul>
</body>
</html>