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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:01:59+00:00 2026-06-12T16:01:59+00:00

When the first dropdown is selected, I’m trying to dynamically update the options in

  • 0

When the first dropdown is selected, I’m trying to dynamically update the options in the second dropdown. It’s working fine in FF, Chrome etc but doesn’t work in IE 8/9 and I don’t understand why. Here’s a jsFiddle

<div class="custom-field">            
    <label for="dropdown1">Select country:</label>
    <select id="dropdown1" name='properties[country]'>
        <option value="USA">USA</option>
        <option value="JAPAN">JAPAN</option>
    </select>
</div>
<div class="custom-field">            
    <label for="dropdown2">Select font:</label>
    <select id="dropdown2" name='properties[font]'>
        <option class="us" value="font1">Font1</option>
        <option class="us" value="font2">Font2</option>
        <option class="us" value="font3">Font3</option>
        <option class="jp" value="font4">Font4</option>
        <option class="jp" value="font5">Font5</option>
        <option class="jp" value="font6">Font6</option>              
    </select>
</div>  



function showFont(fontOpt){
    if (jQuery('#dropdown1').val() === 'USA'){
        var showOptions = fontOpt.filter('.us');
    } else {    
        var showOptions = fontOpt.filter('.jp');
    }
    jQuery('#dropdown2').html(showOptions);
    jQuery('#dropdown2').prop('selectedIndex', 0);
}


$(document).ready(function() {
    // get the child elements of font dropdown
    var fontOptions = $("#dropdown2").children('option');    
    $("#dropdown2").html('');

    showFont(fontOptions);

    $('#dropdown1').on("change", function(e){
        showFont(fontOptions);
    });    

});
  • 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-12T16:02:00+00:00Added an answer on June 12, 2026 at 4:02 pm
    $("#dropdown2").html('');
    

    problem is with this line. Remove this line and your code will work fine.

    Instead of this you may use

    $("#dropdown2").children('option').remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two dropdowns in extjs,based on the first dropdwon,the second dropdown populates.This is
I populate child dropdown (second dropdown) by the onchange event in parent dropdown (first
I am creating a form which has many dynamic dropdown.. values selected in first
I have two dropdownlists ,selecting the first dropdown causes postback and second dropdown gets
I am trying to select dropdown automatically based on values from another dropdown. Second
I am filling a drop down based on the value selected in the first
I have some code that first selects an option value in a dropdown menu
i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
Suppose I have a dropdown (select tag) with 3 values. Our first option has
In my application i have two drop down boxes first box had origin second

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.