How to get the number of the "item selected" when using listgroup (BS4)

I am using listgroup in bootstrap 4. I can add items using “additem(s)”. I can also find the number of items in the listgroup, but I can not figure out how to get the number of the “item selected” when the user clicks on an item in the group… Is there a way to do this?
Thanks, Paul

The text of the selected value is returned. You’ll need go through an array of possible values to see which one it is.

Function Listgroup1_onclick(i)
 If i = 0 Then 
  alert("item no.1 selected");
 Else If i = 1 Then
  alert("item no.2 selected");
 Else If i = 2 Then
  alert("item no.3 selected");
 End If 
End Function

Thank you both. Pro_Certs I like better and will use, but I see how both will work. Thanks. Too bad we have to re-invent the wheel!!!
Thanks guys,
Paul