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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:54:33+00:00 2026-05-25T10:54:33+00:00

Each time I select an option, it displays the list I wanted to but

  • 0

Each time I select an option, it displays the list I wanted to but without hiding the others. Do I forgot something with the toggle function?

$("select#category").change(function() {
   var category = $(this).val();
   $("select#"+category).toggle();
});

My lists are as simple as that (must display either the “1” select or the “2” but not the two):

  <form method="post">
    <select name="menu_destination" id="category">
         <option value="1" >1</option>
         <option value="2">2</option>
    </select>

    <select name="menu_destination" id="1">
         <option value="a" >A</option>
         <option value="b">B</option>
    </select>

    <select name="menu_destination" id="2">
         <option value="a" >A</option>
         <option value="b">B</option>
    </select>

  • 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-25T10:54:34+00:00Added an answer on May 25, 2026 at 10:54 am

    Without seeing your HTML, I’d suggest using siblings(). If this doesn’t work, post your HTML for a more accurate solution.

    $('#' + category).show().siblings().hide();
    

    Working demo: http://jsfiddle.net/AlienWebguy/JgFmY/

    P.S. You should use $('#whatever') vs $('select#whatever'). Unlike CSS, the first one is much faster in JQuery because it uses ECMAScript’s native getElementById() function whereas the latter requires the use of sizzle. Since each DOM node should have a unique ID anyway, there’s no need for the tag name prefix.

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

Sidebar

Related Questions

I'm trying to develop a JS function that creates a new row each time
I have a SharePoint list with 5 options (questions). Each option has a dropdown
I have a multiple select and an autocomplete input. Each time the user insert
I have a table view it displays data which we select time using the
Each time I use Merge() I have the following: 'Cannot implicitly convert type 'void'
Each time I add in the correct code, it gives me the same error
Each time my webpage is loaded it runs a routine in the page_load event
Each time I click on the map a new marker is placed on the
Each time I click the Run as button, I get the following message. The
Each time my user signs in, we pull his profile picture from Facebook. This

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.