Could anybody tell me how I can create this table using my function below?
<tbody>
<tr>
<td><h3>Main1</h3></td>
<td>
<h5>
text1
</h5>
</td>
<td>
<h5>
text2
</h5>
</td>
</tr>
<tr>
<td><h3>Main2</h3></td>
<td>
<h5>
text3
</h5>
</td>
<td>
<h5>
text4
</h5>
</td>
</tr>
</tbody>
Here are my data and my functions. I can only create a table without the inner h3, h5 tags
with it.
data =[['Main1', 'text1', 'text2'],['Main2', 'text3', 'text4']]
var table = document.getElementsByTagName("tbody")[0];
table.innerHTML = "";
for (var i = 0; i < data.length; i++) {
var child = data[i];
var row = table.insertRow();
Object.keys(child).forEach(function (k) {
var cell = row.insertCell();
cell.appendChild(document.createTextNode(child[k]));