<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table id="myTable">
<tr id="myTr">
</tr>
</table>
<p>Click the button to create a TD element.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.createElement("TD");
var t = document.createTextNode("new cell");
x.appendChild(t);
document.getElementById("myTr").appendChild(x);
}
</script>
</body>
</html>