184
rated 0 times
[
186]
[
2]
/ answers: 1 / hits: 30368
/ 6 Years ago, sun, october 21, 2018, 12:00:00
How can I populate a table with JavaScript in the proper way?
function loadTableData() {
//0: Date
//1: Name
var row = document.getElementById(test);
var x = row.insertCell(0);
x.innerHTML = 10/17/2018;
var x = row.insertCell(1);
x.innerHTML = john doe;
}
<table id=myTable class=table table-borderless table-striped table-earning>
<thead>
<tr>
<th>date</th>
<th>file name</th>
</tr>
</thead>
<tbody>
<tr id=test></tr>
</tbody>
</table>
<script>loadTableData();</script>
My current code populates the first two cells but I would like to move to the next column and populate another two cells. Im not sure how to do this the correct way.
More From » html