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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:38:03+00:00 2026-06-17T17:38:03+00:00

I feel like this could have been asked before, but I can’t seem to

  • 0

I feel like this could have been asked before, but I can’t seem to find it, so I’ll ask myself.

I want to select the parent element that is the “cause” of its children being hidden. For example, a group of elements are essentially “hidden” but not because they have display:none but because some parent along the way has display:none.

If I only have a child element and I know that it is hidden, how might I easily find the parent that is causing it to be hidden.

I realize one solution is just to recursively loop through the parents such as…

function findHiddenParent(el){
  var $el = $(el);
  if($el.css('display') == 'none'){
    return $el;
  }
  return findHiddenParent($el.parent());
}

Note I haven’t tested the above code, its just for conceptualizing a solution

But is there an easier way, perhaps through some selector magic?

  • 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-17T17:38:05+00:00Added an answer on June 17, 2026 at 5:38 pm

    Here’s something similar to what you’ve got:

    function findHiddenParents ( el ) {
        return $(el).parents().filter(function () {
            return $(this).css('display') == 'none';
        });
    }
    

    This’ll return all ancestors that are hidden. If you only want the closest or the farthest, you can just return it with .first() or .last() respectively.


    If you’re not actually interested in which elements are hidden, but just want to reveal them all, then you can’t get any simpler than this:

    $(el).parents().show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like this must have been asked before, but I can't find it.
I feel like this must have been asked before, but I've looked at Knockout
This question seems to have been asked before, but I feel like my situation
Sorry if you feel like this has been asked but I have read the
I know that maybe this question has been asked before, but I can't seem
Sorry If something like this has already been asked, but I can't find exactly
Yes, this question has been asked before, but I don't feel there's been a
Questions similar to this have been asked before on SO, but they're not quite
This question has been asked before, but I would like a little more detail
somehow couldn't find this with a google search, but I feel like it has

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.