📜  select2 替换选项 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:11.407000             🧑  作者: Mango

代码示例1
var options = [];
$.each(dataReturn, function (i, obj) {
    //console.log(i);
    //console.log(obj);
    options.push({
        text: obj.NickName,
        id: obj.NickName
    });
})
$("#BeneType").empty().select2({
    data: options
});