Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ how to remove entire table row containing empty TD cells with jquery

Posted by: shankar from vizag Oct 18 2019, 11:15 PM

Greetings

a table contains empty cells.

Can we delete the entire row containing the empty cells with Jquery ?

example

<table>
<tr><td>Sl.No.</td><td>Name</td><td>Hobby</td></tr>
<tr><td>1.</td><td>Edward</td><td>Music</td></tr>
<tr><td>2.</td><td>Chris</td><td>Football</td></tr>

<tr><td>3.</td><td>Edward</td><td></td></tr>


</table>

In the above table, 3rd row 3rd column is empty and I want to remove / hide entire 3rd row.

I used the following jquery script. But its not working in my php page.

<script>
$('td').each(function(){
if($(this).is(:empty)){
$(this).closest('tr').hide();
}
});

</script>

Please suggest, how to do ?

regards
SHANKAR SB

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)