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

  • Home
  • SEARCH
  • 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 6768089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:01:55+00:00 2026-05-26T15:01:55+00:00

I have a combo box with choice 0 – 8 and 8 sets of

  • 0

I have a combo box with choice 0 – 8 and 8 sets of input fields where each set of input fields are wrapped around a div with the same class.

I need to find out how to use Jquery to hide/unhide the divs based on the selected combobox value.
For example, if I select 2, then class=”member1″ and class=”member2″ needs to be visible, the rest are invisible. If i change my mind , and select 1, then class=”member1″ stay visible but member2 and the rest are set to invisible?

<div class="member1"> 
<input id="name1">
<input id="age1">
</div>
<div class="member2"> 
<input id="name2">
<input id="age2">
</div>
:
:
<div class="member8"> 
<input id="name8">
<input id="age8">
</div>
  • 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-26T15:01:56+00:00Added an answer on May 26, 2026 at 3:01 pm

    It is rather simple. Considering selected_number is already an integer extracted from the select field you were talking about, the code could look like this:

    jQuery(function(){
        var selected_number = 2;
        jQuery('.member1, .member2, .member3, .member4, .member5, .member6, .member7, .member8').hide();
        for (var i=1; i<=selected_number;i++){
            jQuery('.member'+i).show();
        }
    });
    

    As a proof see this jsfiddle (change selected_number value to see how it works).

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

Sidebar

Related Questions

I have a combo box on a xaml form (MainWindow). I set the Items
If I have a combo box in pyGTK and would like to set a
I have a combo box on a WinForms app in which an item may
I have a combo box with the following DataTemplate: <DataTemplate x:Key=ComboBoxDataTemplate> <StackPanel> <TextBlock Text={Binding
I have a combo box in Silverlight. It has a collection of values built
I have a combo box in which I have to display the dates from
I have a combo box with a row source based on an SQL query
The problem: I have a combo box that needs to fit into a fixed
I'm using multiple threads in my application. Basically I have a combo box and
I have a read only combo-box with 5 values in, when the user selects

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.