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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:38:08+00:00 2026-05-26T07:38:08+00:00

How would I populate a select dropdown whose values are dependent on what is

  • 0

How would I populate a select dropdown whose values are dependent on what is selected in the parent dropdown. E-g, First dropdown has country names in it, and on selection the next dropdown would load the corresponding states of that country, selected in first dropdown. And then say I have a third dropdown, where I am putting the image of that particular state, that corresponds to what is selected in second dropdown.

How can this be done in JQuery.

E-g

Country>>>>> States>>>>>>Map of This State

  • 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-26T07:38:09+00:00Added an answer on May 26, 2026 at 7:38 am

    Look at this plugin: cascade
    You can have a few css classes for each state those flag you want to show with appropriate background image and swith class on second dropdown change event:

    var statesList = [
        {
        'When': 'US',
        'Value': 'nope',
        'Text': 'Select state'},
    {
        'When': 'US',
        'Value': 'US_AL',
        'Text': 'Alabama'},
    
    {
        'When': 'US',
        'Value': 'US_AK',
        'Text': 'Alaska'},
    {
        'When': 'IN',
        'Value': 'nope',
        'Text': 'Select state'},
    {
        'When': 'IN',
        'Value': 'IN_AP',
        'Text': 'Andra Pradesh'},
    
    {
        'When': 'IN',
        'Value': 'IN_AS',
        'Text': 'Assam'}
    ];
    
    $("#state").cascade("#country", {
        list: statesList,
        template: function(item) {
            return "<option value='" + item.Value + "'>" + item.Text + "</option>";
        },
        match: function(selectedValue) {
            return this.When == selectedValue;
        }
    });
    
    $("#state").change(function() {
        $("#flag").removeClass().addClass($(this).val());
    });
    
    <label>Country
        <select id="country">
            <option value="nope">Choose a country</option>
            <option value="US">United States</option>
            <option value="IN">India</option>
        </select>
    </label>
    
    <label>State
        <select id="state">
            <option value='nope'>Select a country before</option>
        </select>
    </label>
    
    <span id="flag" style="border: 1px solid #000; padding: 1px;">
    </span>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view that I would like to populate data when the next
At the moment I using a dynamic select to populate a dropdown. What I
I need to populate a dropdown list when I select a certain value and
I have a <select> dropdown with which I want to populate the previous 20
I would like to populate a DateTime structure from a string, but it is
I would like to populate a combobox with the following: Visible item / Item
I would like to pre-populate a UITextfield with the phone number of the current
I'm trying to populate a ComboBox programatically. I am creating ComboBoxItems and would like
I have two divs. I would like to move/populate the text from div id
How do I remove all the values from a dropdown list using jQuery? idnum

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.