This package has been deprecated in favor of better-nice-select. Please consider migrating to better-nice-select for continued support and updates: https://www.npmjs.com/package/better-nice-select
Constraining Tag Creation
Use tagsCheck
option via JavaScript or data-tags-check
via attribute to add some logic to the select field to return a Boolean
if an invalid value is entered. You can use the name of a function to set the option or a callback function.
Possible options to search for are: Banana, Apple, Orange, Lemon, Pepper, Mushrooms, Cabbages, Celery, Brocoli, Garlic
<div class="container">
<select id="my-select" multiple="multiple">
<option value="Apple" selected="selected">Apple</option>
</select>
</div>
function checkTag(key) {
if (key.toLowerCase().includes("ä") || key.toLowerCase().includes("ö") || key.toLowerCase().includes("ü")) {
return false;
}
return true;
}
let select = bootstrapNiceSelect.BootstrapNiceSelect("#my-select", {tagsCheck: 'checkTag', tags: true});