You can easily do this by adding the onclick function to the li element and getting its index and get the respective value from the array for that index and saving to your variable
Selecting with mouse seems easy. Most autocomplete interface supports keyboard up/down arrow keys, we need maintain the current selection state somewhere, it does not seem easy to me (I'm a beginner to webdev).
I think your just filtering the names array, How to select the name from the list?
You can easily do this by adding the onclick function to the li element and getting its index and get the respective value from the array for that index and saving to your variable
Selecting with mouse seems easy. Most autocomplete interface supports keyboard up/down arrow keys, we need maintain the current selection state somewhere, it does not seem easy to me (I'm a beginner to webdev).
Yes, I tried with some dynamic data coming from the DB, but on click, is not working. May be because of element rendering problem.
anyhow I fixed my problem in my own way.
Thank you.