From d9ca19ada669c077f5b4d8dd58fa636fadf6deca Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 28 Aug 2020 13:39:39 +0530 Subject: [PATCH] Fix bug with autocomplete showing same option more than once Autocomplete menu had a bug that showed the same item more than once as the user kept on typing. The issue is now fixed since the way the items are closed is reworked and is solidly working all right. --- js/autocomplete.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/js/autocomplete.js b/js/autocomplete.js index 4fd67d1..f2e7a67 100644 --- a/js/autocomplete.js +++ b/js/autocomplete.js @@ -97,12 +97,7 @@ function autocomplete(inp, passedValues) { function closeAllLists(elmnt) { /*close all autocomplete lists in the document, except the one passed as an argument:*/ - var x = document.getElementsByClassName("autocomplete-item"); - for (var i = 0; i < x.length; i++) { - if (elmnt != x[i]) { - x[i].parentNode.removeChild(x[i]); - } - } + document.getElementsByClassName("autocomplete-items-container")[0].innerHTML = ""; } /*execute a function when someone clicks in the document:*/