JSFiddle - React, Tailwind, and code Playground

by WinKiFlyMe

HTML

<input type="text" id="getIndex"/>
<input type="text" />
<input type="text" name="abcGid1" />
<input type="text" name="abcGid2" />
<input type="text" name="abcGid3" />
<input type="text" name="abcGid4" />

JavaScript

var getData=[
    {"index":0,"value":"1111"},
    {"index":1,"value":"2222"},
    {"index":2,"value":"3333"},
    {"index":3,"value":"4444"},
];
$.each(getData,function(i,n){
    $("input[name*='Gid']").eq(n.index).val(n.value);
});
 $("input[name*='Gid']").blur(function(){
    $('#getIndex').val($(this).index());
 });