I have an html input field that is connected to a datalist containing suggestions for autocompletion.
<input type="search" id="input-search" class="form-control" name="searchfield" list="autocompleteitems">
<datalist id="autocompleteitems">
</datalist>
the datalist gets its content through javascript ajax calls when a key is pressed in the search bar.
My autocomplete suggestions contain also synonyms which i want to display. That leads to a problem showed in the following example. Assuming i want to search for "apple" and type ap
ìnto the search bar. The ajax request gets a result list and puts it in my datalist as follows:
<datalist id="autocompleteitems">
<option value="apple"></option>
<option value="fruit"></option>
<option value="apples"></option>
</datalist>
What i want is a suggestion with those three items (apple, fruit apples). Because fruit
does not start with ap
it gets kicked out and only apple
and apples
is suggested.
Is there a way to prevent html/the browser from filtering those items not starting with the text in the searchbox?
Edit The stackoverflow post linked in the comment shows how to set a filter on a search field. But firefox does filter automatically and my question is how to not filter the results.