how to get current index of child in wrap box?

The button does not know its own index in another container. Either give the button an ID or, much better, dispatch the click with some data - so you don’t need to work with IDs / indexes. Posted this today, seems very relevant: