I have a combo box that can be selected multiple times. Here is the HTML.
<select multiple>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
JS Code
$('select').select2();
$('select').change(function(){
$("select").val([]); // clear selected value
});
I want to be able to select more than once on the same option. For example, if I select 1, then I should be able to select 1 again. But, when I select an option in select2, the selected value is removed from the list. I have tried to empty the selected value right after I select a value, but selected value still get removed.
For example, I select an option with value 1. This makes an option with value 1 remove from the list, leaving only 2,3,4,5 in the list. When I select an option with value 2, this option is removed and an option with value 1 is back. This makes the option list become 1,3,4,5.
I want all of the options show up when the option is selected. But, I can't get around this. I have tried every solution possible, but none of it works.