JQuery remove empty td cells

I need to remove all empty td cells, can I do this with jQuery.

<td></td> if(td == empty){ $("td").remove(); } 

I'm not sure how to write what I'm trying to do.

+4
source share
3 answers

This is the path: {pseudo class empty}

 $("td:empty").remove(); 
+9
source

To remove all empty td

 $('td').each(function() { if ($(this).html() == '') { $(this).remove(); } } 
+3
source

You can use .each()

 $("td").each(function() { if ($(this).html() == "") { $(this).remove(); } } 
+2
source

All Articles