admin管理员组文章数量:1304149
I have a Select2 Box, with tagging enabled to add new own tags. Selecting an existing option works without any problem (of any length). But some code prevents me from adding a new option longer than 2 characters long (just can't add more characters). See the JSFiddle
<select class="form-control select2" multiple="multiple" id="employee-groups-select" name="employee[employee_group_ids][]">
<option value="4">Text1</option>
<option value="1">Text2</option>
<option value="3">Text3</option>
<option value="2">Text4</option>
</select>
jQuery code to initialize the select2
$('#employee-groups-select').select2({
theme: 'bootstrap4',
tags: true,
width: '100%',
tokenSeparators: [',', ' '],
});
Help is highly appreciated. I have no idea where to look.
I have a Select2 Box, with tagging enabled to add new own tags. Selecting an existing option works without any problem (of any length). But some code prevents me from adding a new option longer than 2 characters long (just can't add more characters). See the JSFiddle
<select class="form-control select2" multiple="multiple" id="employee-groups-select" name="employee[employee_group_ids][]">
<option value="4">Text1</option>
<option value="1">Text2</option>
<option value="3">Text3</option>
<option value="2">Text4</option>
</select>
jQuery code to initialize the select2
$('#employee-groups-select').select2({
theme: 'bootstrap4',
tags: true,
width: '100%',
tokenSeparators: [',', ' '],
});
Help is highly appreciated. I have no idea where to look.
Share Improve this question edited May 9, 2019 at 7:15 fydelio asked May 8, 2019 at 18:05 fydeliofydelio 9631 gold badge9 silver badges24 bronze badges 2-
How you are doing this?:
But some code prevents me from adding a new option longer than 2 characters long
– Dani Commented May 9, 2019 at 7:21 - @Dani, please see the JSFiddle provided in the description: jsfiddle/rqyzupjv/2 – fydelio Commented May 9, 2019 at 8:27
2 Answers
Reset to default 11Seems to be a bug / patibility issue between the latest select2.js library 4.0.7 and jQuery 3.4.x. See the issue on Github: https://github./select2/select2/issues/5485
UPDATE: Got fixed in version 4.0.8
The slect2 4.0.8 appears to fix it, here it works!
本文标签: javascriptSelect2 Can39t create new options longer than 2 characters (tag true)Stack Overflow
版权声明:本文标题:javascript - Select2: Can't create new options longer than 2 characters (tag: true) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741779797a2397240.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论