javascript select2 allowed tags

别等时光非礼了梦想. 提交于 2019-12-03 06:01:16

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!