Q:

select2 add option

Remove the selected options : 
-----------------------------
$('#mySelect2').val(null).trigger('change');

============================================

Completly remove the select2 initialization :
--------------------------------------------
$('#payment_method').html('').select2({data: [{id: '', text: ''}]});
1
// Set the value, creating a new option if necessary
if ($('#mySelect2').find("option[value='" + data.id + "']").length) {
    $('#mySelect2').val(data.id).trigger('change');
} else { 
    // Create a DOM Option and pre-select by default
    var newOption = new Option(data.text, data.id, true, true);
    // Append it to the select
    $('#mySelect2').append(newOption).trigger('change');
} 
0
$('#select2')
    .select2()
    .on('select2:open', () => {
        $(".select2-results:not(:has(a))").append('<a href="#" style="padding: 6px;height: 20px;display: inline-table;">Create new item</a>');
})
0

New to Communities?

Join the community