i have a table and i have two buttons to add and remove rows to this table .
so adding row is easy (i get 3 rows via ajax every time) .
now i want to be able to remove last 3 rows of table by clicking on remove button
so unless there is some kind of function or …. to remove recent additions to my table ! i need to remove last three rows of table myself
something like
$('#tbl tr:lt(3)').remove();
but last 3 not first ones !
or i have to do something stupid like
function remove(){
var i ;
for(i=0 ; i < 3 ; i++ ){
$('#table tr:last').remove();
}
alert('removed');
}
1 Answer