How do you modify “No Results Found” language in Select2 v4.0

The option noMatches doesn’t appear anywhere in the source code.

The actual option is named noResults. The working version of your example is:

$('#search-select').select2({

   ...

   "language": {
       "noResults": function(){
           return "No Results Found <a href="#" class="btn btn-danger">Use it anyway</a>";
       }
   },
    escapeMarkup: function (markup) {
        return markup;
    }
});

You also need to override escapeMarkup, so the button appears correctly, as per this issue.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)