I have input and I suggest autocomplete list of words from my database using Ajax.
I use bootstrap 4 to design the list, but use <a></a>
tag instead of the <li></li>
tag, because bootstrap 4 provides hover effect when using <a>
instead of <li>
element for my list.
Everything is working the list of words is displaying, but I don't know how to fill the value of the input when, the user clicks on the desired word.
My HTML looks like this:
<form action="index.html" method="post">
<div class="form-group">
<label for="team1">First Team</label>
<input id="team1" type="text" name="team1">
<div id="autoFil" class="list-group col-sm-12"></div>
//Here I generate the list using Ajax which looks like this
<a class="list-group-item list-group-item-action ">Keyword 1</a>
<a class="list-group-item list-group-item-action ">Keyword 2</a>
<a class="list-group-item list-group-item-action ">Keyword n</a>
</div>
</form>