DEV Community

Discussion on: 👨‍💻 Make AutoComplete Input Box In Pure Javascript 🔥🔥

sharmakushal profile image
Kushal sharma Author

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

xuchunyang profile image

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).

manikantapamarthi profile image
Manikanta Nagaraju Pamarthi

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.