Try something like this:
var row = document.getElementById('tr' + rcount);
row.parentElement.removeChild(row);
It also looks like you're not forming the id
of the tr
correctly. You have created it like this:
tr1.id = "t" + t;
then trying to read:
document.getElementById('tr' + rcount)
Also rcount
seems not to be what you expect. It's a global variable, having the same value when addfunction()
is last executed.