Jquery select2 plugin How to get only the result 'myString%'

I am using the jquery-select2 plugin, but I am wondering how I can only get results starting with a typed keyword (e.g. 'myString%')

+3
source share
1 answer

The documentation actually serves as an example for this:

$("select").select2({
    matcher: function(term, text) {
        return text.toUpperCase().indexOf(term.toUpperCase())==0;
    }
});

The above connector is case insensitive, calls are deleted for case sensitivity .toUpperCase().

+10
source

Source: https://habr.com/ru/post/1548155/


All Articles