Select2 - Link to NoMatches format

I use Select2 to improve input <select>. I populate <options>using coldfusion and sql. I want to use formatNoMatchesto add options if there are no matches in the user search. I do not want to use multiple selection because it does not work with my coldfusion, plus it would be much easier to just add the click event to formatNoMatches.

Somewhere in select2.js there is code that stops mouse events due to an event formatNoMatches. Is there a way to hack this that allows mouse events?

$(".select").select2({
    allowClear: true,
    blurOnChange: true,
    openOnEnter: false,
    formatNoMatches: function(term) {
        return "<a href='#' onclick='alert('" + term + "');'"
          + "id='newClient'>Add New Client</a>";
    }
});

I can not get the above code to warn anything.

+5
source share
2 answers

select2 createSearchChoice, . select2 - , , .

0

All Articles