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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:56:47+00:00 2026-06-10T05:56:47+00:00

I have 2 drop down lists, when the user selects dropdown#1 then I need

  • 0

I have 2 drop down lists, when the user selects dropdown#1 then I need to update dropdown#2 with options that are relevant for the dropdown#1 selection.

e.g.

Dropdown#1 has car manufacturers: ford, toyota, honda

Dropdown#2 will be cars for that specific manufacturer.

How should I go about storing this data in javascript?

I was hoping I could create a collection like some sort of dictionary or hash so I can populate each drop down easily.

I have the actual data from the database, then on the server-side I will create the JavaScript I need to create this data structure.

  • 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-10T05:56:49+00:00Added an answer on June 10, 2026 at 5:56 am

    From your comment
    I don't want to make an ajax call, I want to store all the data client side in a javascript object, I am asking how to structure that data

    So just an idea

    HTML

    <select id="cars_company">
        <option value="ford">Ford</option>
        <option value="toyota">Toyota</option>
    </select>
    
    <select id="cars">
        <option value="ford_car_one">Ford Car One</option>
        <option value="ford_car_two">Ford Car Two</option>
    </select>
    

    JS

    $(function(){
        cars={
            ford:{
                ford_car_one:'Ford Car One',
                ford_car_two:'Ford Car Two'
            },
            toyota:{
                toyota_car_one:'Toyota Car One',
                toyota_car_two:'Toyota Car Two'
            }
        };
    
        $('#cars_company').on('change', function(){
            $('#cars').html('');
            $.each(cars[$(this).val()], function(k, v){
                $('<option></option>').val(k).text(v).appendTo($('#cars'));
            });
        });
    });​
    

    DEMO.

    ​

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

Sidebar

Related Questions

I'm using classic asp, I have a drop down list that the user selects
I have a 2 dropdown lists side by side. When user selects from the
I have a user control in a master page with two drop down lists.
I have setup a form that allows a user to make selections from drop-down
I have a drop-down list hardcoded in an MVC View User Control page and
Currently I have a web application where a user can use dropdown lists to
I have a table that includes 27 DropDownLists for user input. My table has
I have implenmented drop-down lists Select menus in jQuery Mobile. <div data-role=fieldcontain> <label for=name
I have three cascaded drop down lists. ddlIllnessType, ddlIllnessSubType and ddlInfectiousAgent Initially, only ddlIllnessType
I have a set of drop down lists (8 in all). All drop downs

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.