I want to insert a th
tag inside tr
of thead
element of a table. I am using insertCell
method of row object created under
You can also use the insertCell method as originally requested. You just have to change the outerHTML to overwrite the To match the example given: HTML Javascript created by the insertCell method:
var table = document.createElement("TABLE")
var row = table.insertRow(0);
row.insertCell(0).outerHTML = "
First "; // rather than innerHTML
First
var tr = document.getElementById('table').tHead.children[0];
tr.insertCell(1).outerHTML = "
Second " // some browsers require the index parm -- 1