Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138192

Prevent filtering autocomplete suggestions in a tag

$
0
0

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 apit gets kicked out and only appleand applesis 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.


Viewing all articles
Browse latest Browse all 138192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>