How to insert row at end of table with HTMLTableElement.insertRow

后端 未结 4 1850
天命终不由人
天命终不由人 2020-12-05 19:07

Background and Setup

I\'m trying to create a table from tabular data in javascript, but when I try inserting rows into a table element, it inserts in the opposite

4条回答
  •  广开言路
    2020-12-05 19:29

    You can do this:

    var table = document.getElementById('myTableId');
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    

提交回复
热议问题