I am trying to get the add button that appears on the next line of each line when I click the add button. I am currently getting an empty text box in the cell where I would like the add button to appear. What do I need to change in my code to get the Add button instead of the text field when I click the Add button?
For the add JavaScript button, I currently have:
var cellRightSel = row.insertCell(3);
var bt = document.createElement('input');
bt.name = 'addBt' + iteration;
bt.id = 'addBt' + iteration;
cellRightSel.appendChild(bt);
and html for the page:
<table border="1" id="tblSample">
<tr>
<th colspan="3">Sample table</th>
</tr>
<tr>
<td><input type="text" name="txtRow1"
id="txtRow1" size="40" /></td>
<td><input type="text" name="txtRow2"
id="txtRow3" size="40" /></td>
<td>
<select name="selRow0">
<option value="value0">text zero</option>
<option value="value1">text one</option>
</select>
</td>
<td><input type="button" value="Add" onclick="addRowToTable();" name="addBt0" /></td>
</tr>
</table>
source
share