Hi All,
I know if I do the following it deletes the row "Remove row" but what I don't know is how I delete the 4 rows above aswell
I know if I do the following it deletes the row "Remove row" but what I don't know is how I delete the 4 rows above aswell
Code:
<table>
<tr>
<td>header 1</td>
<td>answer 1</td>
</tr>
<tr>
<td>header 2</td>
<td>answer 2</td>
</tr>
<tr>
<td>header 3</td>
<td>answer 3</td>
</tr>
<tr>
<td>header 4</td>
<td>answer 4</td>
</tr>
<tr>
<td colspan="2"><a class='link' href='#' onclick='myfun(this)'>Remove Rows</a></td>
</tr>
<tr>
<td>header 5</td>
<td>answer 5</td>
</tr>
<tr>
<td>header 6</td>
<td>answer 6</td>
</tr>
<tr>
<td>header 7</td>
<td>answer 7</td>
</tr>
<tr>
<td>header 8</td>
<td>answer 8</td>
</tr>
<tr>
<td colspan="2"><a class='link' href='#' onclick='myfun(this)'>Remove Rows</a></td>
</tr>
<tr>
<td>header 9</td>
<td>answer 9</td>
</tr>
<tr>
<td>header 10</td>
<td>answer 10</td>
</tr>
<tr>
<td>header 11</td>
<td>answer 11</td>
</tr>
<tr>
<td>header 12</td>
<td>answer 12</td>
</tr>
<tr>
<td colspan="2"><a class='link' href='#' onclick='myfun(this)'>Remove Rows</a></td>
</tr>
</table>
<script>
function myfun(eleme)
{eleme.parentNode.removeChild(eleme);}
</script>