How can I use innerHTML without delete the before innerHTML?
- by Mikelon85
I want to convert an Array to a HTML table, but innerHTML deletes it writes before. Here is the code:
<html><div id="tablaP"></div>
function cargar2() {
document.getElementById('tablaP').innerHTML= "<table>"
var h=1
for (i=0;i<miArray.length;i++){
document.getElementById('tablaP').innerHTML = '<tr>'
for (j=0;j<miArray[i].length;j++){
document.getElementById("tablaP").innerHTML = '<td><td>'
}
document.getElementById('tablaP').innerHTML = '</tr>'
h++
}
document.getElementById('tablaP').innerHTML = '</table>'
}