I have json array named JsonTempArray. And I have mappingId and Name as two fields.
When clicking Male or Female It automatically creates 5 mappingids(1 to 5) and Name field is Empty. Like :-
JsonTempArray[length]=
{
mappingid: Number,//Number has 1 to 5
Name:""
}
And I have bellow text boxes for each 5 people to fill their name.

I have below piece code to update Name field
for(var len=0;len<JsonTempArray.length;len++)
{
if (JsonTempArray[len].Mappingid= mapid ) {
JsonTempArray[len].Name= document.getElementById('txtName'+len).value;
}
}
I will pass Particular mappingid while clicking textbox to this.
Eg: Input is:
1 John
2 Jack
3 Kin
4 Fin
5 Hol
But After updating JsonTempArray has
5 Hol
5 Hol
5 Hol
5 Hol
5 Hol
Please help me to find how to update each value in loop.
Thank you
mapid?