I have a question, I currently have an HTML table, but I would like to add rows dynamically, I'm trying to do it in the DOM way, but I can not get it, my table looks like this:
<table border="1" id="tablaprueba">
<thead>
<tr>
<th>ID</th>
<th>Nombres</th>
<th>Ap Paterno</th>
<th>Ap Materno</th>
</tr>
</thead>
<tbody></tbody>
</table>
and in the following way I am trying to add rows but I do not succeed, I think I still do not understand well how to interact with DOM
function agregarFila() {
var Tbl = document.getElementById("tablaprueba");
var tblBody = Tbl.getElementsByTagName("tbody");
var hilera = document.createElement("tr");
var celda = document.createElement("td");
var textoCelda = document.createTextNode("celda");
celda.appendChild(textoCelda);
hilera.appendChild(celda);
tblBody.appendChild(hilera);
Tbl.appendChild(tblBody);
}