是的,你可以!我建议使用对象类型。所以试试下面的
$(document).on('change','select#country',function(){
var CodeList = {
Netherlands : "Code: NL. A currency in Netherlands is Euro (EUR)",
Poland : "Code: PL. A currency in Poland is Polish Zloty (PLN)"
}
var xd = $(this).find('option:selected').text()
alert(CodeList[xd]) //use a var from received text (which equal to var)
})