JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript">
function getindex(node) {
var index = Array.prototype.indexOf.call(node.parentNode.children, node);
alert(index);
}
</script>
<div>
<input type="button" name="test" value="test" onclick="getindex(this)"> <!--index 0-->
<input type="button" name="test" value="test" onclick="getindex(this)"> <!--index 1-->
<input type="button" name="test" value="test" onclick="getindex(this)"> <!--index 2-->
<input type="button" name="test" value="test" onclick="getindex(this)"> <!--index 3-->
</div>