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