xaverian
10-01-2012, 02:02 PM
Hi ,
I have a html table with some rows. Each row has a 'remove row' button in the end as <td>.
Now I want that corresponding row to be deleted if the 'remove row' button is clicked.
Let us consider the table name is "mytable"
The code is like :
<td> <input type = 'button' value = 'remove row' onclick = remRow() name = remove_i > </td>
function remRow()
{
document.getElementById("mytable").deleteRow(3);
}Right now, I passed hard-coded value '3' to deleteRow in order to delete the third row. But how can I dynamically get the row number as and when a row is clicked and delete it.
Please help. Thanks.
I have a html table with some rows. Each row has a 'remove row' button in the end as <td>.
Now I want that corresponding row to be deleted if the 'remove row' button is clicked.
Let us consider the table name is "mytable"
The code is like :
<td> <input type = 'button' value = 'remove row' onclick = remRow() name = remove_i > </td>
function remRow()
{
document.getElementById("mytable").deleteRow(3);
}Right now, I passed hard-coded value '3' to deleteRow in order to delete the third row. But how can I dynamically get the row number as and when a row is clicked and delete it.
Please help. Thanks.