Given the following json:
    var obj = [
{
  "Name": "John",
  "id": 1
},{
  "Name": "Mike",
  "id": 2
},{
  "Name": "Maria",
  "id": 3
},{
  "Name": "Jen",
  "id": 4
},{
  "Name": "Ben",
  "id": 5
}
]
I outputted all the Names of the json file through a for loop.
for (var i = 0; i < obj.length; i++) {
   output+= obj[i].Name+' Rename ' + '<button onclick="dublicateF(i)">Dublicate</button>' + ' Delete'+ '<br>';
}
How do I make sure that the Duplicate button that I click actually duplicates the element (and outputs it real time)? The i value that gets transfered to the dublicateF function is always equals to 5. (the length/size of the json elements)
I tried following steps from this question which is similar: - but it outputs all the Buttons next to each other instead of next to each respective element.
Obviously as you can tell, later I will have to do the same with delete and rename, but I suppose that if I figure out the duplicate, the others wont be much different.
Thanks
