Skip to content

Commit a64be99

Browse files
author
Tomas Kirda
committed
Merge pull request devbridge#42 from nilsga/master
Fix for issue devbridge#40
2 parents 5619531 + 83108c1 commit a64be99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/jquery.autocomplete.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179

180180
// Listen for click event on suggestions list:
181181
container.on('click', suggestionSelector, function () {
182-
that.select($(this).data('index'));
182+
that.select($(this).data('index'), false);
183183
});
184184

185185
that.fixPosition();
@@ -297,7 +297,7 @@
297297
that.hide();
298298
return;
299299
}
300-
that.select(that.selectedIndex);
300+
that.select(that.selectedIndex, e.keyCode === keys.RETURN);
301301
if (e.keyCode === keys.TAB && this.options.tabDisabled === false) {
302302
return;
303303
}
@@ -515,13 +515,13 @@
515515
return null;
516516
},
517517

518-
select: function (i) {
518+
select: function (i, shouldIgnoreNextValueChange) {
519519
var that = this,
520520
selectedValue = that.suggestions[i];
521521

522522
if (selectedValue) {
523523
that.el.val(selectedValue);
524-
that.ignoreValueChange = true;
524+
that.ignoreValueChange = shouldIgnoreNextValueChange;
525525
that.hide();
526526
that.onSelect(i);
527527
}

0 commit comments

Comments
 (0)