I am trying to create a dropdown list that takes two input parameters (name, IPAddress). I have declared global variable Name and IP to track which name and ip address have been selected. However, the part that I am having a trouble is that it is not recognizing the IP address. Single name can have multiple IP address that I want to recognize both name and IP address when it was selected in dropdown list :(
Any advise on this would be appreciated! Thank you!
//called after name changed
function selectName(){
Name = $(#"name :selected").val();
}
//create dropdown list for name and IPAddress
function createDropList (name, IPAddress){
$('#name').empty();
$('#name').append('<option disabled selected value=""> Select Name </option>');
for (var i=0; i<IPAddress.length; i++) {
$('#name').append('<option value= "'+name[i]+'" >'+IPAddress[i] + " (IP :"+IPAddress[i] +")" +'</option>');
}}