Hi I'm populating a single select dropdown and using an array to populate the dropdown as follows:
var myOptions = {
val1 : 'Albuquerque Aero (NM75)',
val2 : 'Albuquerque FM&T (NM14)',
val3 : 'Allentown (PA19)'
};
At the moment the dropdown 'value' and 'text' uses the same information pulled from the above array as follows:
$('<option></option>').val(text).html(text)
I need to have a different piece of information shown in the 'text' element so I wanted to use a multi-array as opposed to two separate arrays (more efficient?) but I'm struggling to get my head around multi-arrays in Javascript/ jQuery.
Is it as simple as:
var myOptions = {
val1 : 'Albuquerque Aero (NM75)','Different text',
val2 : 'Albuquerque FM&T (NM14)','Different text',
val3 : 'Allentown (PA19)','Different text'
};
How could I achieve what I am looking for? Is it even possible?