I need to allow users select ONLY allowed tags in select.
Currently I have that:
$("input#id_txtcolor").select2({tags:["red", "green", "blue"]});
Can you help me please with that?
I need to allow users select ONLY allowed tags in select.
Currently I have that:
$("input#id_txtcolor").select2({tags:["red", "green", "blue"]});
Can you help me please with that?
as of 3.3 you can specify your own createSearchChoice when using tags that will always return null, thus preventing the default choice from being created.
$().select2({
createSearchChoice: function() { return null; },
tags:...
});
Sometimes we developer don't use our 7th sense that is common sense also happened with me struggled for 2 hours then it clicked my sense..
if you want user to select only allowed values then its no more tagging its selecting So just remove tags:true
option and keep mulitple
attribute in select, provide options directly in select element or load remote data.
© 2022 - 2024 — McMap. All rights reserved.
maximumInputLength
to 0, that might prevent the user from entering new tags? – Colossus