You could just clone the first row that has the inputs, then get the nested inputs and update their ID to add the row number (and do the same with the first cell).
function deleteRow(row)
{
var i=row.parentNode.parentNode.rowIndex;
document.getElementById('POITable').deleteRow(i);
}
function insRow()
{
var x=document.getElementById('POITable');
// deep clone the targeted row
var new_row = x.rows[1].cloneNode(true);
// get the total number of rows
var len = x.rows.length;
// set the innerHTML of the first row
new_row.cells[0].innerHTML = len;
// grab the input from the first cell and update its ID and value
var inp1 = new_row.cells[1].getElementsByTagName('input')[0];
inp1.id += len;
inp1.value = '';
// grab the input from the first cell and update its ID and value
var inp2 = new_row.cells[2].getElementsByTagName('input')[0];
inp2.id += len;
inp2.value = '';
// append the new row to the table
x.appendChild( new_row );
}
Demo below
function deleteRow(row) {_x000D_
var i = row.parentNode.parentNode.rowIndex;_x000D_
document.getElementById('POITable').deleteRow(i);_x000D_
}_x000D_
_x000D_
_x000D_
function insRow() {_x000D_
console.log('hi');_x000D_
var x = document.getElementById('POITable');_x000D_
var new_row = x.rows[1].cloneNode(true);_x000D_
var len = x.rows.length;_x000D_
new_row.cells[0].innerHTML = len;_x000D_
_x000D_
var inp1 = new_row.cells[1].getElementsByTagName('input')[0];_x000D_
inp1.id += len;_x000D_
inp1.value = '';_x000D_
var inp2 = new_row.cells[2].getElementsByTagName('input')[0];_x000D_
inp2.id += len;_x000D_
inp2.value = '';_x000D_
x.appendChild(new_row);_x000D_
}
_x000D_
<div id="POItablediv">_x000D_
<input type="button" id="addPOIbutton" value="Add POIs" /><br/><br/>_x000D_
<table id="POITable" border="1">_x000D_
<tr>_x000D_
<td>POI</td>_x000D_
<td>Latitude</td>_x000D_
<td>Longitude</td>_x000D_
<td>Delete?</td>_x000D_
<td>Add Rows?</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>1</td>_x000D_
<td><input size=25 type="text" id="latbox" /></td>_x000D_
<td><input size=25 type="text" id="lngbox" readonly=true/></td>_x000D_
<td><input type="button" id="delPOIbutton" value="Delete" onclick="deleteRow(this)" /></td>_x000D_
<td><input type="button" id="addmorePOIbutton" value="Add More POIs" onclick="insRow()" /></td>_x000D_
</tr>_x000D_
</table>
_x000D_