Suppose I have a table:
<table id="mytable">
<tr>1</tr>
<tr>2</tr>
<tr>3</tr>
<tr>4</tr>
<tr>5</tr>
<tr>6</tr>
...
...
</table>
I know you can use ('#mytable').find("tr:gt(n)").remove();
to remove all rows after nth row.
But is there a similar function to let you specify a range of rows you want to remove? say I want to remove row 2 to row 5? or I just want to remove row 2?
do i have to add an id to each row to achieve this?
thanks
You can use jQuery slice(start,[end]) for a range and eq(index) for single rows.