简体   繁体   English

删除 select2 3.5 标签上的删除按钮?

[英]Remove delete button on select2 3.5 tag?

I'm referring to Select2 3.5 .我指的是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.我可以通过select2-removing事件和调用ev.preventDefault()防止特定标签被删除,但是,我也想直观地表明它不能被删除。

Is there a way to remove the 'X' beside the tag?有没有办法删除标签旁边的“X”?

Probably you can hide.也许你可以隐藏。 The 'X' is placed inside an anchor which has css class "select2-search-choice-close". 'X' 放置在一个锚点内,该锚点具有 css 类“select2-search-choice-close”。 So you can add css for that所以你可以为此添加css

.select2-search-choice-close{display:none !important;}

This will get rid of the x button这将摆脱 x 按钮

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
    display:none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM