Not able to select previous selected option

Just started with select2 and found the following issue.

   $('#category').select2({placeholder: "Select a category"});
   $.each(categories, function (i, obj) {
          $('#category').append($('<option>', {
                 value: obj.id,
                 text: obj.name
           }));
   }});

   $('#category').change(function () {
          reloadItems()
   });

When you select an item, and then another, the previous selected stays grey and it is not possible to select it again:

image

I believe that this is by design. Actually, selecting a previously-selected item should unselect it.

Oh, I see what you are saying. Previously selected options are grayed out even after you select a new option?

I can’t reproduce it on the docs page, so it’s probably due to the way you are using Select2. A few things:

What does reloadItems do? Do you have the same problem when you remove your change handler?

Have you tried adding your new options before initializing Select2?