The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> how to remove entire table row containing empty TD cells with jquery
shankar from vizag
post Oct 18 2019, 11:15 PM
Post #1


Advanced Member
****

Group: Members
Posts: 166
Joined: 18-June 13
Member No.: 19,316



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

This post has been edited by shankar from vizag: Oct 18 2019, 11:54 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 9th December 2019 - 05:29 AM