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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:18:35+00:00 2026-05-26T03:18:35+00:00

I have 2 drop downs. In the first one you choose a model, in

  • 0

I have 2 drop downs. In the first one you choose a model, in the second a specific model.
http://jsfiddle.net/QskM9/

For example:

drop down 1: 
Nokia 
Samsung
Apple -if this is selected, the second drop down shows:

Drop down 2:
iPhone 3
iPhone 3Gs
iPhone 4 -When this is selected, go to www.apple.com (for example)

I’ve been trying this the whole day and cant seem to make this work.
This is what I’ve got so far:

// HTML
<form method="get" name="box">
<select id="opsaetning" name="opsaetning" onchange="changelist(this)">
<option selected="selected">Model</option> 
<option label="Apple">Apple</option>
<option label="Nokia">Nokia</option>
<option label="Samsung">Samsung</option>
 </select>

 <select id="model" name="model" onchange="document.location=$(this).val();">
<option value="www.apple.com" selected="selected">iphone 4</option> 
 </select>
 </form>

//SCRIPT
<script type="text/javascript" language="javascript">
        var lists = new Array();
        // Apple
        lists['Apple'] = new Array();
        lists['Apple'][0] = new Array(
        'Forbered Gmail til mobilen');

        lists['Apple'] = new Array(
        'www.apple.com/ihphone3g',
        'www.apple.com/iphone4');

        function changelist(){
        list = lists[box.options[box.selectedIndex].value];
        sletListe(box.form.model);
        fyldListe(box.form.model, list);
        }

        function sletListe(box){
        while(box.options.length)box.options[0] = null;
        }

        function fyldListe(box, lists){
            for(i=0; i< arr[0].length; i++){
                option = new Option(arr[0][i], arr[l][i]);
                box.options[box.length] = option;
            }
            box.selectedIndex=0;
        }
</script>

Can anyone help me get it working? Note I can’t use PHP, .NET, Perl etc. only HTML and js/jq.

  • 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-26T03:18:35+00:00Added an answer on May 26, 2026 at 3:18 am

    give this a try:

    var options = {
        "Apple" : {
            'ihphone3g': 'http://www.apple.com/ihphone3g',
            'iphone4': 'http://www.apple.com/iphone4'
        }
    }
    function changelist(v){
        var $t = $("#model");
    
        //clear old options
        $t.html('');
    
        //fill up new options
        if(options[v]){
            for(var i in options[v]){
                if(options[v].hasOwnProperty(i)){
                    $t.append('<option value="' + options[v][i] + '">' + i + '<\/option>')
                }
            }
        }
    }
    

    heres a demo http://jsfiddle.net/j7qK6/

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

Sidebar

Related Questions

Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
I have two Drop Down Lists, the second ones are based off which one
I have two drop down lists. Second one is populated based on value chosen
I have 2 drop-down menus. User selects something from the first one, then the
I have a set of drop down lists (8 in all). All drop downs
I have a C#.Net MVC3 web app. I am using Drop Down lists all
I have 2 drop down list, one is college and other is branch, so
I have two drop down menus, one of which I am trying to replace
I have n drop-downs like this: <select id=select1> <option>1</option> <option>2</option> <option>3</option> </select> <select id=select2>
I have a drop down like this on my page: <p> <%= f.label :episode_id

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.