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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:26:22+00:00 2026-06-03T01:26:22+00:00

Possible Duplicate: display dropdown values based on previous dropdown I know html pretty well

  • 0

Possible Duplicate:
display dropdown values based on previous dropdown

I know html pretty well and about forms a little bit, but would like to know, for example:

when clicking on a certain drop down list item, a certain second drop down list appears based on the previous field choice. how would you go about incorporating this, is there a specific website I can go to?

an example of code would be appreciated. I am assuming that you could use javascript for this?
do you retrieve specific values or just use different drop down lists for specific choices

Thanks

  • 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-03T01:26:23+00:00Added an answer on June 3, 2026 at 1:26 am

    of the top of my head.

    You would handle your javascript on the page, before you submit your form.

    step 1. reference jquery in your header
    step 2. on load, hide the second select, put this script beneath you reference jquery

    <script type="text/javascript">
    $(function () {
       $("#secondselect").hide()
    
       $("#firstselect").change(function () {
                if($(this).val() != 0){
                   $("#secondselect").show()
                }
                else
                {
                    $("#secondselect").hide()
                }
    
            });
    });
    </script>
    
    
    <select id="firstselect" name="firstselect" >
        <option value="0">first</option>
        <option value="1">second</option>
        <option value="2">third</option>
        <option value="3"></option>
    </select>
    
    <select id="secondselect" name="secondselect">
        <option value="0">first</option>
        <option value="1">second</option>
        <option value="2">third</option>
        <option value="3"></option>
    </select>
    

    Of the top of my head… but i’d do it something like that.

    Good luck.

    Oh… just a quick update.

    You could use a switch instead of an if like so, might be a bit tidier…

    FROM

    if($(this).val() != 0){
                   $("#secondselect").show()
                }
                else
                {
                    $("#secondselect").hide()
                }
    

    TO

    switch($(this).val())
    {
        case '1':
           $("#secondselect").show();
        break;
        case '1':
           //do something else... show a third dropdown instead
           //for instance...
           // $("#thirdselect").show();
           alert('got to case 1');
           //or if you use firebug or chrome, right click and inspect an element then click on Console and this log report should show
           console.log('got here, showing the log');
        break;
        default:
           $("#secondselect").hide();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to differentiate between iphone4 and iphone 3 Well, I know all
Possible Duplicate: display text in uiwebview in iphone I have a String in HTML
Possible Duplicate: JavaScript data formatting/pretty printer I am getting a bit tired of looking
Possible Duplicate: Is there a tool that can display a SVN repository visually (
Possible Duplicate: Working with latitude/longitude values in Java Duplicate: Working with latitude/longitude values in
Possible Duplicate: Why doesn’t VS 2008 display extension methods in Intellisense for String class
Possible Duplicate: Display numbers from 1 to 100 without loops or conditions Interview question:
Possible Duplicate: What's the best way to display an image from a sql server
Possible Duplicate: Round a double to 2 significant figures after decimal point I know
Possible Duplicate: Is Java pass by reference? I have a question about passing by

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.