JSFiddle - React, Tailwind, and code Playground

by tr_santi

CSS

table * {
    border: 1px solid black;
}

table tr td {
    width: 100px;
    height: 100px;
}

JavaScript

function createTable(cols, rows) {
    var table = $("<table/>");
    for (var i = 0; i < cols; i++) {
        var newRow = $("<tr/>");
        
        for (var j = 0; j < rows; j++) {
			var newCell = $("<td/>", {id: (i+1)+"-"+(j+1)});
            newRow.append(newCell);
        }
        
        table.append(newRow);
    }
    $('body').append(table);
}

createTable(3,8);