add table row dynamically

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
ratina10

Thu Oct 15, 2015 2:51 am

With JavaScript you can add HTML element dynamically. So, try with JavaScript code.

johnmacd
New php-forum User
New php-forum User
Posts: 72
Joined: Wed Jun 12, 2013 9:30 pm
Contact:

Fri Apr 08, 2016 4:27 am

Hi,

Create and delete row(s):
function myCreateFunction()
{
var table = document.getElementById("myTable");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = "NEW CELL1";
cell2.innerHTML = "NEW CELL2";
}

function myDeleteFunction()
{
document.getElementById("myTable").deleteRow(0);
}


Thanks

Post Reply