Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6134021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:18:12+00:00 2026-05-23T17:18:12+00:00

For the table below, row2 and row3 have more than 1 empty cell( <td></td>

  • 0

For the table below, row2 and row3 have more than 1 empty cell(<td></td>), how can I use jQuery to check if each row in the table have more than 1 empty cell, than hide that row accordingly?

UPDATED:

If I want to check if each row(td) contain more than ONE cell(td) that is containing JUST witespace, than hide that row?

Thanks

<table>
<tr class="row1">
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
</tr>
<tr class="row2">
<td>a</td>
<td>b</td>
<td></td>
<td></td>
</tr>
<tr class="row3">
<td></td>
<td></td>
<td>c</td>
<td></td>
</tr>
...
<tr class="row100">
<td>a</td>
<td>b</td>
<td>c</td>
<td></td>
</tr>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:18:13+00:00Added an answer on May 23, 2026 at 5:18 pm

    In actual use, “empty” cells often contain all kinds of whitespace. EG: <td> </td>, <td> \n </td>, <td>&nbsp;</td>, <td class="Invalid"></td>, etc.
    See how easy it is to break?

    A more robust solution handles real-life HTML:

    $('table tr').filter ( function () {
        var blankCells  = $(this).html ().match (/<td[^<>]*>(?:\s|&nbsp;)*<\/td>/ig);
        var numBlank    = blankCells ? blankCells.length : 0;
        return numBlank > 1;
    } ).hide ();
    

    See the demo at jsFiddle.

    Note that this solution is probably fine for most practical cases, but since it uses regex to parse the DOM (even a little), it could end up showing extra rows if the HTML was coded poorly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the table below, all cell under row2 ( tr class=row2 ) is empty,
The table below works well. However, I am trying to pass $row[username] along as
i have the table below <tr id=group_1>...</tr> <tr id=el>...</tr> <tr id=el>...<tr> <tr id=group_2></tr> <tr
In the table below, the entire cells are hyperlinks. How can I make just
I have a table as below Name Priority Date ------------------------- A 2 d1 B
I have a table like below: EmployeeId EmployeeName RequestId RequestName EmployeeId RequestId I need
I have a table as below dbo.UserLogs ------------------------------------- Id | UserId |Date | Name|
We have a composite primary key for the site table defined below. Functionally, this
The table below displays all words in the string $commentstring . How can I
I have a table with some customer data. I am using jquery hover to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.