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 7665185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:29:52+00:00 2026-05-31T14:29:52+00:00

I have a table which has a couple of columns that do not have

  • 0

I have a table which has a couple of columns that do not have required fields. This page has a mechanism to filter out content from the table which is being done client side and I am using jQuery to select the elements to hide however things do not appear to be working as expected. It works fine if I filter by some string however the behavior of an empty filter should leave only those rows with empty cells in that column.

Example table:

<table>
  <tr>
    <td class="firstCol">Some text</td>
    <td class="secondCol"><a href="##">A link!</a></td>
  </tr>
  <tr>
    <td class="firstCol"></td>
    <td class="secondCol"></td>
  </tr>
</table>

For the first column I’m doing something like:

$('table tr').find('.firstCol:not(:empty)').parent().hide();

This works for this column. All that would remain visible are the rows without content in the first column.

If I do:

$('table tr').find('.secondCol:not(:empty)').parent().hide();

All rows from column 2 are removed. Is there a generic way to select this to return only <td>s matching this behavior when they have no content? Not that it should matter but these are generated rows from a query and I have checked in the browser and the cell does not have content.

Thanks in advance.

  • 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-31T14:29:54+00:00Added an answer on May 31, 2026 at 2:29 pm

    I am not sure I understand your problem. Take a look at this jsFiddle. It does exactly what you want it to do.

    $('table tr').find('.firstCol:not(:empty)').parent().hide();
    

    If there is content in the firstCol td, then hide the tr that contains it (including the secondCol td, no matter if it has content or not).

    $('table tr').find('.secondCol:not(:empty)').parent().hide();
    

    If there is content in the secondCol td, then hide the tr that contains it (including the firstCol td, no matter if it has content or not).

    With the HTML you provided, both JS snippets end up doing the same thing. They hide the first tr.

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

Sidebar

Related Questions

I have a table which has a couple cells that contain simple numbers (IE:
I have an unusual SQL table (not mine) which has the following fields (among
I have a table which has the below columns. Ticket_id (Primary key, Int) Attachment1
if i have a table which has columns with fixed lenght, Will mySQL count
We have a table that has a blob column along with other simple fields.
Scenario: I have an application that has a config table which stores the config
I have userid and role id fields in the table. In that table couple
I have a table which has several one to many relationships with other tables.
I have a table which has two text boxes and an image beside it
I have a table which has employee relationship defined within itself. i.e. EmpID Name

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.