Select2: How to remove instead of gray out item from dropdown when its selected

Created on 15 Feb 2015  路  2Comments  路  Source: select2/select2

Hey, first of all, gr8 plugin...I used select2 3,4,1, and in that version, when you select item, it was removed from drop down...now its just grayed out...Is there a way to remove it instead of gray it out? Thanks in advance

Most helpful comment

I tried this but it doesnt seem to work well.
This one worked well for me -
.select2-results__option[aria-selected="true"] {
display: none;
}

All 2 comments

There's a classic theme that you can use you get back then old theme, which includes removing the gray background for selected options.

https://select2.github.io/examples.html#themes

You can also just hide the selected options with

.select2-results__option--highlighted[aria-selected=true] {
  display: none;
}

I tried this but it doesnt seem to work well.
This one worked well for me -
.select2-results__option[aria-selected="true"] {
display: none;
}

Was this page helpful?
0 / 5 - 0 ratings