Skip to content

Commit

Permalink
Excludes non alphanumeric characters from minChars check
Browse files Browse the repository at this point in the history
  • Loading branch information
Faisal Feroz committed Jul 27, 2023
1 parent 1c00c94 commit 0056c53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dist/jquery.autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@

that.fixPosition();

if (that.el.val().trim().length >= that.options.minChars) {
if (that.el.val().replace(/[^A-Z0-9]/ig, '').length >= that.options.minChars) {
that.onValueChange();
}
},
Expand Down Expand Up @@ -493,7 +493,7 @@
return;
}

if (query.trim().length < options.minChars) {
if (query.replace(/[^A-Z0-9]/ig, '').length < options.minChars) {
that.hide();
} else {
that.getSuggestions(query);
Expand Down Expand Up @@ -776,7 +776,7 @@
var that = this,
onHintCallback = that.options.onHint,
hintValue = '';

if (suggestion) {
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
}
Expand All @@ -786,7 +786,7 @@
if ($.isFunction(onHintCallback)) {
onHintCallback.call(that.element, hintValue);
}
}
}
},

verifySuggestionsFormat: function (suggestions) {
Expand Down
Loading

0 comments on commit 0056c53

Please sign in to comment.