I am trying to add a new row to this little table with just one column. Can anybody help? I created a new function for this purpose, for the moment it is not working.
function row_creator() {
var table = document.getElementById("myTable")[0];
var newRow = table.insertRow();
var newCell = newRow.insertCell(0);
var newText = document.createTextNode('New row');
newCell.appendChild(newText);
}
row_creator();
table,
th,
td {
border: 1px solid black;
}
<! --COMIENZO TABLA -->
<table id="MyTable" class="egt">
<! --PRIMERA LINEA -->
<tr>
<th>Source ID</th>
</tr>
<! --SEGUNDA LINEA -->
<tr>
<td>
<input type="number" id="fname" name="fname">
</td>
<tr>
</table>