Suppose you have a html table of the
<form id="myForm">
<table id="myTable">
<tr>
<th>One</th>
<th>Two</th>
<th>Three</th>
</tr>
<tr>
<td>Alpha</td>
<td>Bravo</td>
<td><a href="javascript:remove(1)">X</a></td>
</tr>
<tr>
<td>Charlie</td>
<td>Delta</td>
<td><a href="javascript:remove(2)">X</a></td>
</tr>
<tr>
<td>Echo</td>
<td>Foxtrot</td>
<td><a href="javascript:remove(3)">X</a></td>
</tr>
</table>
</form>
<a href="javascript:reset()">Reset</a>
I have the following javascript
var table = document.getElementById('myTable');
var form = document.getElementById('myForm');
var formSave = form.innerHTML;
function remove(rowID)
{
table.deleteRow(rowID);
}
function reset()
{
form.innerHTML = formSave;
}
For some reason, the remove()
function works fine, but after using the reset()
function, it no longer works. Can anyone tell me why this is?