This removes a row from a table unless the row is the last row in the table.
function removeRow(el) {
while (el.parentNode && el.tagName.toLowerCase() !== 'tr') {
el = el.parentNode;
}
if (el.parentNode && el.parentNode.childElementCount > 1)
{
el.parentNode.removeChild(el);
}
}