Remove entire row if all td's are empty

HTML
<div class="container"> <h1 class="text-center">Remove entire row if all td's are empty</h1> <table class="table table-bordered"> <tr> <td>qwe1</td><td>ewq1</td> </tr> <tr> <td></td><td></td> </tr> <tr> <td></td><td></td> </tr> <tr> <td></td><td></td> </tr> <tr> <td></td><td></td> </tr> <tr> <td></td><td></td> </tr> <tr> <td>qwe2</td><td>ewq2</td> </tr> <tr> <td></td><td></td> </tr> <tr> <td></td><td></td> </tr> <tr> <td></td><td></td> </tr> <tr> <td>qwe3</td><td>ewq3</td> </tr> <tr> <td>qwe4</td><td>ewq4</td> </tr> <tr> <td></td><td></td> </tr> </table> </div>
CSS
JAVASCRIPT
checkEmptyCells(".table tr"); function checkEmptyCells(tableClass){ var checkedTable = $(tableClass); var trs = $(checkedTable); for(var i=0;i<trs.length;i++){ var fl=true; var tds=trs.eq(i).children('td'); for(var j=0;j<tds.length;j++) if($.trim(tds[j].innerHTML)!='')fl=false; if(fl)trs.eq(i).remove(); } }
Expand for more options Login