html select option change other select option

Solutions on MaxInterview for html select option change other select option by the best coders in the world

showing results for - "html select option change other select option"
Xerxes
14 Mar 2017
1<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
2<select id="type">
3    <option value="item0">--Select an Item--</option>
4    <option value="item1">item1</option>
5    <option value="item2">item2</option>
6    <option value="item3">item3</option>
7</select>
8
9<select id="size">
10    <option value="">-- select one -- </option>
11</select>
12
13<script>
14$(document).ready(function () {
15    $("#type").change(function () {
16        var val = $(this).val();
17        if (val == "item1") {
18            $("#size").html("<option value='test'>item1: test 1</option><option value='test2'>item1: test 2</option>");
19        } else if (val == "item2") {
20            $("#size").html("<option value='test'>item2: test 1</option><option value='test2'>item2: test 2</option>");
21        } else if (val == "item3") {
22            $("#size").html("<option value='test'>item3: test 1</option><option value='test2'>item3: test 2</option>");
23        } else if (val == "item0") {
24            $("#size").html("<option value=''>--select one--</option>");
25        }
26    });
27});
28</script>
queries leading to this page
change select optionif i select one option change option in other automaticallywhen i change the select option in html it want to change another lementchange div on select optionchange select box on another select bochange select option selected in anothermodify select option in htmlselected option changechoose collection based on select boxin html can i change option with another elementchange the selected option of html selectoption selected changechange in html with select box changechange options from select on selecting other selectchange html depending on selected optionif i select on select option other select automatically in optionuse on change directly on html selectchange option selectedturn select option other waychange the option from selectswitch div with select optionchange select option colotchange other value with selecthtml select depend on another selectonchange select based on another selecthow to change html select element optionselect change optionhow to change a select options based on another dropdownhtml change select optionhow to select option and change htmlselect option another optionhow to change selected option onchange another selectjquery show ioptipn aserlecvt depond ion another selevt optionselect option value change how to change option values based on another dropdownchange the select option based on another selectwhen change select optionchange selected option selectedhtml select option change other select optionhow to change the select option depending on another select optuionon select option 2c fill antother select option with valuejs change select options when a specific option selected from other selecthow to change a selection options based on another select option selectedhtml selected option changedropdown change selected optionhtml select option change other select option