How to remove all rows of the table but keep the header How to remove all rows of the table but keep the header asp.net asp.net

How to remove all rows of the table but keep the header


$('#tblDetailFourn tbody').empty();


Try http://api.jquery.com/child-selector/

$("#<%=tblDetailFourn.ClientID%> > tbody > tr").remove();

What you have should work though.


Try using this:

$('#<%=tblDetailFourn.ClientID%> tr').not(function(){ return !!$(this).has('th').length; }).remove();