Skip to content

Commit 873c051

Browse files
committed
doesn't quite work yet
1 parent 14beaa8 commit 873c051

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/autocomplete.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ inputBox.onkeyup = (e)=>{
1818
linkTag.click();
1919
}
2020
emptyArray = languages.filter((data)=>{
21-
//filtering array value and user characters to lowercase and return only those words which are start with user enetered chars
21+
//filtering array value and user characters to lowercase and return only those words which are start with user entered chars
2222
return data[2].toLocaleLowerCase().startsWith(userData.toLocaleLowerCase());
2323
});
2424
// Uniq the list
2525
emptyArray = emptyArray.map((data)=>{
2626
// passing return data inside li tag
27-
return data = '<li>'+ data[2] +'</li>';
27+
return data = '<li data-value="'+data[1] +'">'+ data[2] +'</li>';
2828
});
2929
searchWrapper.classList.add("active"); //show autocomplete box
3030
showSuggestions(emptyArray);
@@ -41,6 +41,8 @@ inputBox.onkeyup = (e)=>{
4141
function select(element){
4242
let selectData = element.textContent;
4343
inputBox.value = selectData;
44+
var lang = inputBox.getAttribute('data-value')
45+
console.log('select() ' + selectData + ' / ' + lang);
4446
icon.onclick = ()=>{
4547
webLink = "http://demo.omnilingo.xyz/" + selectData;
4648
linkTag.setAttribute("href", webLink);

0 commit comments

Comments
 (0)