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>