Answers for "select2 trigger select"

2

select2.org events

$('#mySelect2').on('select2:select', function (e) {
    var data = e.params.data;
    console.log(data);
});
Posted by: Guest on July-20-2020
0

select2 replace options

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
});
Posted by: Guest on December-28-2020

Browse Popular Code Answers by Language