2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-22 12:55:12 +00:00

Added maxChar option

There is now an option available for maxChar. If the user types more
than the maxChar the request will not complete, acting just the same as
if minChar is set. maxChar default value is 150 characters.
This commit is contained in:
William Reiske 2014-08-15 14:04:23 -04:00
parent a9e79277fb
commit dd9976cf23

View File

@ -60,6 +60,7 @@
onSelect: null,
width: 'auto',
minChars: 1,
maxChars: 150,
maxHeight: 300,
deferRequestBy: 0,
params: {},
@ -199,7 +200,7 @@
onFocus: function () {
var that = this;
that.fixPosition();
if (that.options.minChars <= that.el.val().length) {
if (that.options.minChars <= that.el.val().length && that.options.maxChars >= that.el.val().length) {
that.onValueChange();
}
},
@ -461,7 +462,7 @@
}
}
if (query.length < options.minChars) {
if (query.length < options.minChars || query.length > options.maxChars) {
that.hide();
} else {
that.getSuggestions(query);