我有以下功能,
function setDropdownValue(dropdownId,selectedValue){
$('#'+dropdownId+' option').each(function(){
if ($(this).val().toLowerCase()==selectedValue.toLowerCase()){
//found the option i was looking for, do what i want
$(this).val(selectedValue);
}
});
}
我正在传递dropdownId=$('#dp1")
,selectedValue='Bat'
并且由于某种原因我的 each() 函数没有被执行..我这样打电话setDropdownValue($("#dp1"),'Bat');
我错过了什么吗?