I have set of table rows, each row has input elements defined with only name[] attribute,
<tr id="1">
<td><input name="billdate[]" required="required" class="form-control" placeholder="DD/MM/YYYY"></td>
<td><input class="form-control" name="amt[]" required="required" value="0" type="text"></td>
<td><input name="gst[]" class="form-control" value="0" required="required" type="text"></td>
<td><input name="netamt[]" class="form-control" required="required" value="0" type="text"></td>
<td><input name="glcode[]" class="form-control" required="required" value="" type="text"></td>
</tr>
I have added JavaScript code to clone table row, code written below
var row = document.getElementById("1"); // find row to copy
var table = document.getElementById("asd"); // find table to append to
var clone = row.cloneNode(true); // copy children too
clone.id = document.getElementById("setid").value; // change id or other attributes/contents
table.appendChild(clone);
cloning is working fine, but the problem is that I want to assign unique ids to each input element. Is there any easy way to do this? I tried several ways to add but did not succeeded.