td, th {
  padding: 10px;
  border: 1px solid #ccc;
}
body {
  padding: 1rem;
}
var table = document.createElement('table'),
    tbody = document.createElement('tbody'),
    i, rowcount;

table.appendChild(tbody);

for (i = 0; i <= 3; i++) {
  tbody.insertRow(i);
  for (x = 0; x <= 2; x++) {
    tbody.rows[i].insertCell(x);
    tbody.rows[i].cells[x].appendChild(
        document.createTextNode('Row ' + i + ', Col ' + x)
    );
  }
}

table.createCaption();
table.caption.appendChild(
  document.createTextNode('A DOM-generated Table')
);

document.body.appendChild(table);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js

Packages

This Pen doesn't use any packages.