CLICK FOR DEMO
In the example below I am unable to get pick[0] to retrive the correct value.
If pick[0] is hardcoded with one of the object values e.g A[0] the code works as expected.
QUESTION
How can I retrieve the first array value from the javascript object depending on the array selected?
JQUERY
var pick = $( "#select option:selected" ).text(),
myArray = {
A: ['#004d94', '#0073b9'],
B: ['#f6f0c1', '#b9cdaf']
};
$(function () {
$('.Bx').css('background', myArray.pick[0]);
$('.Tx').text(pick);
});