var t="<table id='datatable'>"; t+=" <tbody><tr><td>head1</td><td> head </td><td> head 1</td></tr>"; t+="<tr><td>value from db</tr></td>"; t+=" </tbody></table>"; document.getElementById('invitee').innerHTML=t;//div tag
function addRow() { var table = document.getElementById('dataTable'); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell2 = row.insertCell(0); cell2.innerHTML = "SDGF"; var cell3 = row.insertCell(1 ); var element2 = document.createElement("input"); element2.type = "button"; element2.name = "delete"; cell3.appendChild(element2); }
getElementById
Quote:var table = document.getElementById('dataTable');
var table = document.getElementById('datatable');
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)