magritton
5/17/2017 - 6:27 PM

This removes a row from a table unless the row is the last row in the table.

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);
    }  
}