I'm adding new rows to a table dinamically, with this code:
tbody = document.getElementById('tbody');
tr = tbody.insertRow(-1);
tr.id = 'last';
th = tr.insertCell(0);
td = tr.insertCell(1);
But what I actually got are two TD
cells. I want a TH
, as you can see.
It says the tagName
property isn't changeable.
How can I do this? Will I need to use 'normal' methods like createElement
and appendChild
?