How to remove selected option from the option list in select2 multiselect and show selected options in the order they are selected

前端 未结 7 1305
一生所求
一生所求 2021-02-02 08:19

I have select2 multi select field in my form where I want to remove the selected option from the dropdown list after it is selected and again add it to the list if it is removed

7条回答
  •  星月不相逢
    2021-02-02 08:55

    $(document).ready(function(){
      $('#dynamicAttributes').select2({
            allowClear: true,
            minimumResultsForSearch: -1,
            width: 600
      });
    });
    

    this make a error when click the remove sign button

    TypeError: this.placeholder is undefined

    use

     $(document).ready(function(){
          $('#dynamicAttributes').select2({
                allowClear: true,
                minimumResultsForSearch: -1,
                width: 600,
                placeholder: 'past your placeholder'
    
          });
    });
    

提交回复
热议问题