I migrated from chosen to select2 plugin because it works better for me, but its documentation is very poor when compared to chosen. Could anyone tell me what option(s) shou
Select2 provides an example in the documentation on how to use a custom matcher
function for matching search terms to search results. The example given is this exact use case.
function matchStart (term, text) {
if (text.toUpperCase().indexOf(term.toUpperCase()) == 0) {
return true;
}
return false;
}
$.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) {
$("select").select2({
matcher: oldMatcher(matchStart)
})
});