let consider multiple dimensional array contains some records and I have two dropdown list  

1) list1  

2) list2  

Now,  

I want to add an array values on list2 via changing of list1. If the value of list1 is "-1" then list2 must be remove or hidden. Else empty list2, make it visible and insert values from array in list1. I have done it but there is some queries which i couldn't solve. Please help me.  

Thanks in advance.  

Here is the code:

```
<select id="list1" onchange="changeVal(this.value);">
   <option value="-1">Select any option</option>
   <option value="0">test1</option>
   <option value="1">test2</option>
   <option value="2">test3</option>
</select>
<select id="list2">
</select>

function changeVal(i){
  var Arr = [
    ['Dummy 1.1','Dummy 1.2','Dummy 1.3'],
    ['Dummy 2.1','Dummy 2.2','Dummy 2.3'],
    ['Dummy 3.1','Dummy 3.2','Dummy 3.3']
];

if(i != "-1"){
    $("#list2").html("");
    $("#list2").css("visibility","visible");
    for (var addOption = 0; addOption < Arr[i].length; addOption++){
        var option = $("<option></option>");
        $("#list2").append(option);
        option.html(Arr[i][addOption]);
    }
}

else{
      $("#list2").remove();
   }
}

```