Skip to content

Commit 0056c53

Browse files
author
Faisal Feroz
committed
Excludes non alphanumeric characters from minChars check
1 parent 1c00c94 commit 0056c53

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

dist/jquery.autocomplete.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226

227227
that.fixPosition();
228228

229-
if (that.el.val().trim().length >= that.options.minChars) {
229+
if (that.el.val().replace(/[^A-Z0-9]/ig, '').length >= that.options.minChars) {
230230
that.onValueChange();
231231
}
232232
},
@@ -493,7 +493,7 @@
493493
return;
494494
}
495495

496-
if (query.trim().length < options.minChars) {
496+
if (query.replace(/[^A-Z0-9]/ig, '').length < options.minChars) {
497497
that.hide();
498498
} else {
499499
that.getSuggestions(query);
@@ -776,7 +776,7 @@
776776
var that = this,
777777
onHintCallback = that.options.onHint,
778778
hintValue = '';
779-
779+
780780
if (suggestion) {
781781
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
782782
}
@@ -786,7 +786,7 @@
786786
if ($.isFunction(onHintCallback)) {
787787
onHintCallback.call(that.element, hintValue);
788788
}
789-
}
789+
}
790790
},
791791

792792
verifySuggestionsFormat: function (suggestions) {

0 commit comments

Comments
 (0)