I have array for exchange rate currencies:
var mainCCexArr = [{EUR: 0.80 , GBP: 3.50}];
how do i alert array value by key?
for instant - i need value for key "GBP" -> 3.5
Can i do it without array LOOP (for, while, etc) ?
HTML:
<select name="def_cc">
<option value="GBP">UK</option>
<option value="USD">USD Dollar</option>
</select>
I tries this:
var def_cc_code = $('select[name="def_cc"] option:selected').val();
var ex_cc = mainCCexArr[def_cc_code].value;
alert("ex_cc: " + ex_cc);
Thank you in advance