Desidero rimuovere tutte le righe della tabella tranne l'intestazione.Come rimuovere tutte le righe della tabella mantenendo l'intestazione
Questo è quello che ho provato, ma cancella sempre tutte le righe e intestazione:
$("#<%=tblDetailFourn.ClientID%> tbody tr").remove();
$("#<%=tblDetailFourn.ClientID%> tbody tr").not("thead tr").remove();
$("#<%=tblDetailFourn.ClientID%> tr").not("thead tr").remove();
$("#<%=tblDetailFourn.ClientID%> tbody").not("thead").remove();
$("#<%=tblDetailFourn.ClientID%> tbody").remove();
$("#<%=tblDetailFourn.ClientID%> > tbody").remove();
Ecco il codice html:
<table id="tblDetailFourn" runat="server" class="ProjetTable ProjetTableHover">
<thead>
<tr>
<th style="width:200px">Rôle de Ressource</th>
<th style="width:200px">Nom Prénom</th>
<th style="width:120px">Tel</th>
<th style="width:200px">Courriel</th>
<th style="width:80px">Actif</th>
<th style="width:33px"></th>
<th style="width:33px"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
La tabella non ha righe del corpo ??? Sembra che abbia funzionato ??? –
'$ (" # <% = tblDetailFourn.ClientID%> tbody tr "). Remove();' è corretto. Cosa sta realmente accadendo quando si esegue lo script? – jrummell
questa è solo la struttura. Lo riempio con ajax – Marc