Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use select2 purely as a tokenizer, disabling the dropdown/search/match functionality?

I have multiple instances of select2 elements in my form, but in one of them (which is on a hidden input) I want to just tokenize the input.

I dont want the dropdown to ever show because it always shows "no matches found" and it confuses users. So I need to disable just the dropdown and use select2 as only a tokenizer for that specific element. Is that possible?

(I know I can do this easily with out the plugin but I want to use the plugin as it decorates the tokens and removes icon and it will be uniform with other inputs that use it)

like image 433
Paralife Avatar asked Jan 13 '23 05:01

Paralife


1 Answers

Used the approach described by @Paralife.

Found there is a option dropdownCss which sets the dropdown style. So dropdownCss:{display:'none'} is enough to disable it as well.

like image 59
Igor Malyk Avatar answered Jan 17 '23 11:01

Igor Malyk