I have a datalist with some options and it's also storing the value I'm searching. I want to add a delete button (X) or trash icon beside the options to delete the selected item but it's not working. The code I have is-
<Input list="search" name="search" id="mainsearch">
<Datalist id="search">
<Option value="test1"></option>
<Option value="test2"></option>
<Option value="test3"></option>
</Datalist>
The code I tried to make delete button in options is-
<Input list="search" name="search" id="mainsearch">
<Datalist id="search">
<Option value="test1"> <button class="btn"> <i class="fa
fa-trash" </i></button></option>
<Option value="test2"><button class="btn"> <i class="fa
fa-trash" </i></button></option>
<Option value="test3"><button class="btn"> <i class="fa
fa-trash" </i></button></option>
</Datalist>
The button not showing beside the option, if it will show then I can use jQuery to make the button work but I don't know where I'm wrong, if there is any other way to make this work, please suggest. Thank you!