Select2 – 过滤特殊字符

我有一个select2插件的问题。 当我使用filter并输入“mąka”时,它会找到所有带有“mąka”和“maka”字样的选项。 是否可以自定义此脚本以查找“mąka”字样?

预览这里

对不起我的英文; p

谢谢!

来自select2网站https://select2.github.io/examples.html#matcher

小提琴: https : //jsfiddle.net/alaniex/c3Ls1uf3/1/

function matchStart (term, text) { if (text.toUpperCase().indexOf(term.toUpperCase()) == 0) { return true; } return false; } $.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) { $(".js-example-matcher-start").select2({ matcher: oldMatcher(matchStart) }) });