var id;
var html1;
var html2;
for (var item in data) {
if (item.id == id) {
html1 += '<option value="' + item.id + '">' + item.name + '</option>';
}
else {
html2 += '<option value="' + item.id + '">' + item.name + '</option>';
}
}
var id;
var html1;
var html2;
for (var item in data) {
if (item.id == id) {
html1 += '<option value="' + item.id + '">' + item.name + '</option>';
}
else {
html2 += '<option value="' + item.id + '">' + item.name + '</option>';
}
}
转载于:https://www.cnblogs.com/jianghaidong/p/4756643.html