Add table row in jQuery

前端 未结 30 2332
既然无缘
既然无缘 2020-11-21 05:40

What is the best method in jQuery to add an additional row to a table as the last row?

Is this acceptable?

$(\'#myTable\').append(\'

        
30条回答
  •  攒了一身酷
    2020-11-21 06:24

    You can use this great jQuery add table row function. It works great with tables that have and that don't. Also it takes into the consideration the colspan of your last table row.

    Here is an example usage:

    // One table
    addTableRow($('#myTable'));
    // add table row to number of tables
    addTableRow($('.myTables'));
    

提交回复
热议问题