Disable dropdown opening on select2 clear

前端 未结 4 546
有刺的猬
有刺的猬 2021-02-04 01:16

Seems that select2 4 opens by default the dropdown when clearing the current selected item. Previous versions of select2 didn\'t seem to have that behaviour and I\'m trying to a

4条回答
  •  鱼传尺愫
    2021-02-04 01:56

    Another simple Implementation:

    $('select').on('select2:unselect', function(evt) {
        $(this).select2({
            placeholder : {
                id : '',
                text : '---None Selected---'
            },
            allowClear : true,
            theme : "bootstrap"
        }).select2('close');
    });
    

提交回复
热议问题