I am using select2 for some time now, but I just started using multi selects. Since the beginning I am having the same issue.
Whenever I make a multiselect dropdown with the requirement of minimum 1 character, it tells me "Please enter 1 or more characters", fine right?
Well when I click somewhere else in my page this popup persists.
How to remove this issue?
$("#e1").select2({
minimumInputLength: 1
});
http://jsfiddle.net/Jeanpaul1994/3tfcm83n/1/
EDIT
My multi select. @Html.DropDownListFor(model => model.Visit.ExtraHosts, new List(), null, new { @class = "form-control select2-customselector", @multiple = "multiple" })
My Ajax call.
$('#@Html.IdFor(model => model.Visit.EmployeeId), #@Html.IdFor(model => model.Visit.ExtraHosts)').select2({
ajax: {
url: '@Url.Action("GetHostsViaAJAX", "Visitors")',
dataType: 'json',
type: "POST",
data: function (params) {
return {
searchTerm: params.term
};
},
processResults: function (data) {
return { results: data };
}
},
placeholder: "@IAMMVCResources.SelectAHost",
minimumInputLength: 1,
allowClear: true
});