I'm referring to Select2 3.5 .
I want to hide the close/delete button on one of the tags so that it can't be removed.
I can prevent a specific tag from being removed via the select2-removing
event, and calling ev.preventDefault()
, however, I also want to visually indicate that it can't be removed.
Is there a way to remove the 'X' beside the tag?
Probably you can hide. The 'X' is placed inside an anchor which has css class "select2-search-choice-close". So you can add css for that
.select2-search-choice-close{display:none !important;}
This will get rid of the x button
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
display:none;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.