removing rows from a table : specifying row index
Hi All,
This is having me puzzled.
I have table with id = "rules" and <tbody> tag defined. I am trying to delete all the rows except first two rows in <tbody> .
$('#rules > tbody > tr:gt(1)').remove(); //this works (if I assign '1' directly in command)
However, the following code doesn't work.
var a = 1;
$('#rules > tbody > tr:gt(
a)').remove(); //doesn't work .
I tried different approaches, and in all cases if I assign a integer value as index , it works. However, if I assign a variable for index, it doesn't work.
Can you help me please?