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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:34:18+00:00 2026-06-18T18:34:18+00:00

I have multiple sets of checkboxes that show/hide a div based on which checkbox

  • 0

I have multiple sets of checkboxes that show/hide a div based on which checkbox is checked. This can be done with IDs but I will have multiple sets of these on the same page and need a more generic selector such as a class or selecting closest elements to the checkbox.

Maybe someone knows why this is not selecting correctly or knows a better way?
http://jsfiddle.net/infatti/h3rh7/

$('.check-hide-show-content').hide(); // hide all content divs

// begin show/hide
$('.check-hide-show input:checkbox').click(function () {

    $(this).parent().next('.check-hide-show-content').show();


    $(".check-hide-show input[type='checkbox']").not(this).prop("checked", false); // uncheck the other checkbox when this is checked
});
  • 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-18T18:34:19+00:00Added an answer on June 18, 2026 at 6:34 pm

    pretty simple:

    $('.check-hide-show-content').hide(); // hide all content divs
    
    // begin show/hide
    $('.check-hide-show input:checkbox').change(function () {
        $('.check-hide-show-content').hide().eq($(this).index('.check-hide-show input:checkbox')).show();
        $(".check-hide-show input[type='checkbox']").not(this).prop("checked", false); // uncheck the other checkbox when this is checked
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pattern like this that matches multiple sets of values: (((\w+) (\d+))+)
I have a form that has multiple sets of checkboxes that initially load all
Right now I'm creating a web-app which requires that multiple sets of data (including
I have this problem that I have multiple fields that updates a database via
I have multiple sets of xy pairs that I want to plot. I want
I have a PostgresQL function that returns multiple resultsets. I can extract these resultsets
I have a webpage with multiple checkboxes (code for one of them below): <div>
I have a QMainWindow, which creates multiple QDialog child windows and sets itself as
I have multiple winforms applications that download large sets of reference data on startup.
I have multiple applications that share a config file that sets up NLog partially

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.