I am working on a table with a unique functionality. The table has 5 rows, but only the first row is visible while the last 4 rows are hidden.
<table>
<tr>
<th>sr</th>
<th>Head</th>
</tr>
<tr style="display:block;">
<td>1</td>
<td>row 1</td>
</tr >
<tr style="display:none;">
<td>2</td>
<td>row 2</td>
</tr>
<tr style="display:none;">
<td>3</td>
<td>row 3</td>
</tr>
<tr style="display:none;">
<td>4</td>
<td>row 4</td>
</tr>
<tr style="display:none;">
<td>5</td>
<td>row 5</td>
</tr>
</table>
<button id="add">Add row</button>
<button>Remove row</button>
Here is what I have attempted using javascript:
$('#add').click(function() {
rows.show();
});
The desired functionality is that when the "Add row" button is clicked, the next hidden row should be displayed. Similarly, clicking on "Remove row" should hide the latest visible row.