$.each(data, function(key, Citys) {
$("#" + exchange).append(
'<option value="' + Citys.CityID + '"' + (Citys.CityID == CityIDes[counter] && flag == true ? " selected='selected' " : " ") + '>' +
Citys.CityName +
'</option>');
if (Citys.CityID == CityIDes[counter]) {
flag = false;
CityIDes[counter].remove() // does not work
}
// }
});
我想将城市附加到下拉列表,并在CityID等于数据库中的CityIdes时选择选项。