JSFiddle - React, Tailwind, and code Playground
by lithium182
HTML
<div id='myDiv'></div>
CSS
td {
border: 1px solid black;
}
JavaScript
var myTable = document.createElement('table');
var tbody = document.createElement('tbody');
myTable.appendChild(tbody);
var numberOfRows = 2;
var numberOfCellsInRow = 5;
for (var i = 0; i < numberOfRows; i++) {
var tempRow = document.createElement('tr');
for (var j = 0; j < numberOfCellsInRow; j++) {
var tempCell = document.createElement('td');
tempCell.innerHTML = 'myCell';
tempRow.appendChild(tempCell);
}
tbody.appendChild(tempRow);
}
var myDiv = document.getElementById('myDiv');
myDiv.appendChild(myTable);