Difference between revisions of "Jquery table things"

From John Freier
Jump to: navigation, search
(Created page with 'These are a bunch of different table manipulation things. Add a new row to a table $('#tableId tr:last').after('<tr><td>item</td></tr>'); Remove all the rows of a table. …')
(No difference)

Revision as of 13:30, 22 September 2011

These are a bunch of different table manipulation things.


Add a new row to a table

 $('#tableId tr:last').after('<tr><td>item</td></tr>');


Remove all the rows of a table.

 $('#form-batch').each(function(){
    while($('tr', this).length>1){
       $('tbody tr:eq(1)', this).remove();
    }
 });