JSFiddle - React, Tailwind, and code Playground

by lulu2792

HTML

<div id="div1">
</div>

JavaScript

// create table
var html = "<table id='table1'><tbody><tr><td>Test</td></tr></tbody></table>";
document.getElementById('div1').innerHTML = html;

// append a row into table
var tr = document.createElement('tr');
var td = document.createElement('td');
td.innerHTML = 'ABC';
tr.appendChild(td);
var s = tr.innerHTML;
tr.innerHTML = s;
tr.innerHTML = '<td>' + 'ABC' + '</td>';
var tbody = document.getElementById('table1').getElementsByTagName('tbody')[0];
tbody.appendChild(tr);