简体   繁体   English

select2-无条件标记术语

[英]select2 - tagging of terms without restrictions

I use select2 widely and data is pulled via ajax in all cases. 我广泛使用select2,并且在所有情况下都通过ajax提取数据。 But for one field, I need to let users type terms of their choice and I should covert those to tags. 但是对于一个字段,我需要让用户键入他们选择的字词,然后将其隐藏到标签中。 How can i let select2 do tagging not bound to pre-defined values (like ajax). 我如何让select2做未绑定到预定义值的标记(如Ajax)。 Just free text as user decides? 只是用户决定的自由文本? I use Select2 4.0.0 我使用Select2 4.0.0

I think I found it... Looks like the below construct allows free tagging... 我想我找到了...看起来下面的结构允许免费标记...

$("#inp_select2_b").select2(
    {
        placeholder: "Add your tags here",
        maximumSelectionLength: 5,
        allowClear: true,
        tags: true
    }
);

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

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