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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:22:57+00:00 2026-05-27T04:22:57+00:00

I found this little bit of code in a project: if ($(.c1 .c2).is(:hidden)){ $(.c1).hide();

  • 0

I found this little bit of code in a project:

if ($(".c1 .c2").is(":hidden")){
    $(".c1").hide();
} else {
    $(".c1").show();
}

It seems quite tautological to me, since it semme to hide something if it hidden, or show it otehrwise. The only thing is the difference in selectors used, so there is some possible side effect. Changing it:

if ($(".c1").is(":hidden")){
    $(".c1").hide();
} else {
    $(".c1").show();
}

it would really do nothing, right?

Related HTML is as follow:

<span class="c1">
  <span>  </span>
  <span class="c2"> </span>
</span>

CSS as follow

.c1{ display: none; }
  • 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-27T04:22:58+00:00Added an answer on May 27, 2026 at 4:22 am

    This line:

    if ($(".c1 .c2").is(":hidden")){
    

    Is not checking if .c1 is hidden, but is rather checking if .c2 (which must be a descendant of .c1 element, per the selector) is hidden.

    Therefore it is essentially acting on the parent based on the status of the child.

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

Sidebar

Related Questions

found this little code snippet that seems to do what i want, but im
I've recently added this little bit of code to my .htaccess file: RewriteCond %{REQUEST_FILENAME}
Say I have this little bit of code: public static void LoadSomething(Type t) {
I have this little bit of code: using System; using System.Web.Mvc; public class SecureFilter
This might sound a little bit silly, but I haven't found a definitive answer.
I am just cleaning up my code a little bit and I found a
I have little question. I found this on internet: Type t = typeof(MyClass); MethodInfo[]
I wanted to use groovy for a little ftp script and found this post
I'm a little confused as to why this doesn't give an error. I found
I've been struggling with this issue for a little while now. Found several posts

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.