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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s