Q:

Remove TFoot when TBody tr's are empty

I have a table with header,body and footer. when my table body is empty then i need to hide my table footer also.
My Code:
$("#tid tfoot tr").html("");

A:

Try this:
<TABLE id="myTable">
<THEAD>
     <TR> <TD>..HEADER.. </TD> </TR>
</THEAD>
<TBODY>
     <TR> <TD>...first row... </TD> </TR>
     <TR> <TD>...second row... </TD> </TR>
     <TR> <TD>...third row... </TD> </TR>
</TBODY>
<TFOOT>
     <TR> <TD>..FOOTER.. </TD> </TR>
</TFOOT>
</TABLE>

<script type="text/javascript"> 
$( document ).ready(function() {
  if(!$.trim($("#myTable tbody").html())) { // check if empty
    document.getElementById("myTable").deleteTFoot(); // delete footer
  } 
});
</script>

