how to insert row in runtime in javascript


function AddRow(){
var table = document.getElementById(“myTable”);
if (!table) throw “Table not found”;
var row = table.insertRow(-1); //append at the end
var cell1 = row.insertCell(-1);
var cell2 = row.insertCell(-1);
cell1.innerHTML = ‘2’;
cell2.innerHTML = ‘test’;
}

1 sam
Advertisements