While w3school is one of the most helpful tools on the internet to get ideas, advices and code.
BUT a lot of times seems to miss the extra feature that you would like in your code.
Like the autocomplete which is not working on mobile devices.
When you have a list and you try to click to select, it is only working on desktop environments.
The only thing that is missing is the «touch» or «touchstart» event that a mobile device need:

FROM:

b.addEventListener("click", function(e) {
/*insert the value for the autocomplete text field:*/
inp.value = this.getElementsByTagName("input")[0].value;
/*close the list of autocompleted values,
(or any other open lists of autocompleted values:*/

closeAllLists();
});

Just copy paste the function and add the extra event:

b.addEventListener("click", function(e) {
/*insert the value for the autocomplete text field:*/
inp.value = this.getElementsByTagName("input")[0].value;
/*close the list of autocompleted values,
(or any other open lists of autocompleted values:*/

closeAllLists();
});
b.addEventListener("touchstart", function(e) {
/*insert the value for the autocomplete text field:*/
inp.value = this.getElementsByTagName("input")[0].value;
/*close the list of autocompleted values,
(or any other open lists of autocompleted values:*/

closeAllLists();
});