We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fef68b6 commit e572acfCopy full SHA for e572acf
src/jquery.autocomplete.js
@@ -127,8 +127,13 @@
127
$.Autocomplete = Autocomplete;
128
129
Autocomplete.formatResult = function (suggestion, currentValue) {
130
- var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
+ // Do not replace anything if there current value is empty
131
+ if (!currentValue) {
132
+ return suggestion.value;
133
+ }
134
135
+ var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
136
+
137
return suggestion.value
138
.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
139
.replace(/&/g, '&')
0 commit comments