diff --git a/dist/autocomplete.js b/dist/autocomplete.js index 61d59f3..63dfbb3 100644 --- a/dist/autocomplete.js +++ b/dist/autocomplete.js @@ -194,9 +194,10 @@ var AutoComplete = (function () { }], Callback: function (event) { if (this.DOMResults.getAttribute("class").indexOf("open") != -1) { - event.preventDefault(); var liActive = this.DOMResults.querySelector("li.active"); if (liActive !== null) { + event.preventDefault(); + this._Select(liActive); this.DOMResults.setAttribute("class", "autocomplete"); } diff --git a/src/autocomplete.ts b/src/autocomplete.ts index a61f0c1..1a4fb9e 100644 --- a/src/autocomplete.ts +++ b/src/autocomplete.ts @@ -133,11 +133,10 @@ class AutoComplete { }], Callback: function(event) { if (this.DOMResults.getAttribute("class").indexOf("open") != -1) { - event.preventDefault(); - var liActive = this.DOMResults.querySelector("li.active"); if (liActive !== null) { + event.preventDefault(); this._Select(liActive); this.DOMResults.setAttribute("class", "autocomplete"); } @@ -211,7 +210,7 @@ class AutoComplete { Callback: function() { var oldValue = this.Input.getAttribute("data-autocomplete-old-value"), currentValue = this._Pre(); - + if (currentValue !== "" && currentValue.length >= this._MinChars()) { if (!oldValue || currentValue != oldValue) { this.DOMResults.setAttribute("class", "autocomplete open"); @@ -275,7 +274,7 @@ class AutoComplete { return this.MinChars; } - return parseInt(minchars, 10); + return parseInt(minchars, 10); }, /**