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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:42:44+00:00 2026-06-07T03:42:44+00:00

I am getting frustrated over a simple problem where I cannot find the issue:

  • 0

I am getting frustrated over a simple problem where I cannot find the issue:

I want to filter rows from a table by looking for any cells having been marked as “filtered” because of different criteria. So a final row filtering kind of “selects” the filtered cells to decide if the containing row is to be filtered.

Here is the simplyfied example:

html:

<table>   <tbody>
    <tr class="">
        <td class=""><span>1-1</span></td>
        <td class=""><span>1-2</span></td>
        <td class=""><span>1-3</span></td>      
    </tr>
    <tr class="">
        <td class=""><span>2-1</span></td>
        <td class="filtered"><span>2-2</span></td>
        <td class="filtered"><span>2-3</span></td>      
    </tr>
    <tr class="">
        <td class=""><span>3-1</span></td>
        <td class="filtered"><span>3-2</span></td>
        <td class=""><span>3-3</span></td>      
    </tr>   </tbody> </table>

​css:

table { margin: 20px; }
td { padding:4px; }
td span { background-color: silver; }
tr.filtered { display:none; }​

js/jquery:

$('table tbody tr').filter('td.filtered').addClass('filtered');

I prepared a fiddler for this:
http://jsfiddle.net/dtsZX/3/

I would expect rows 2 and 3 to get the class “filtered” added, thus being hidden.
However that does not work.
What is wrong with the jquery command ?

  • 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-06-07T03:42:45+00:00Added an answer on June 7, 2026 at 3:42 am

    You want :has:

    $('table tbody tr:has(td.filtered)').addClass('filtered');
    

    The trs themselves can never match td! Instead, you want to filter trs that have a td as their descendant.

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

Sidebar

Related Questions

I'm getting frustrated trying to do a simple thing - I want to invoke
I'm getting frustrated because I am failing to have any control over my bar
I am getting frustrated with PDT. I want the .phtml files to be opened
I am getting frustrated over a java.net.SocketOutputStream that just refuses to flush properly! I
I have a question regarding file reading and I am getting frustrated over it
I am really getting frustrated with Google Chrome... I have version 3.0.195.27 and want
I am really getting frustrated now! I have a new problem now, all I
Getting frustrated looking for answers for hours on this one... I have an .xml
I`m realy getting frustrated, I am trying to show some items from a XML
I'm getting overly frustrated with this issue. First of all, this did work fine

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.