var elems = document.querySelectorAll('tr input[value=""]'); elems.forEach(input => input.closest('tr:last-child').remove());