Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 446

How to insert a row in an HTML table body in JavaScript

$
0
0

I have an HTML table with a header and a footer:

<table id="myTable"><thead><tr><th>My Header</th></tr></thead><tbody><tr><td>aaaaa</td></tr></tbody><tfoot><tr><td>My footer</td></tr><tfoot></table>

I am trying to add a row in tbody with the following:

myTable.insertRow(myTable.rows.length - 1);

but the row is added in the tfoot section.

How do I insert tbody?


Viewing all articles
Browse latest Browse all 446

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>