js get index from array

I have this code that I believe dynamically

<select name="list[]"></select>
<input name="field[]">

<select name="list[]"></select>
<input name="field[]">


<select name="list[]"></select>
<input name="field[]">

I would like the onchange of a select to be returned to me the index to dynamically fill the relative input