1

I am using a datalist element, but I need the autocomplete to detects if any of the words I'm typing in the box are in the list.

Here's my code

<input type="text" list="cars" />
<datalist id="cars">
  <option>Volvo</option>
  <option>Saab</option>
  <option>Mercedes Benz</option>
  <option>Audi</option>
</datalist>

For example, right now, if I type "Benz", it won't show me anything even though the word "Benz" is somewhere in the list.

Here's a Fiddle in case you want to play with it a bit. Is that something possible using the HTML5 datalist element? Thanks!

larin555
  • 1,669
  • 4
  • 28
  • 43
  • Possible duplicate of [Use HTML5 (datalist) autocomplete with 'contains' approach, not just 'starts with'](http://stackoverflow.com/questions/29154877/use-html5-datalist-autocomplete-with-contains-approach-not-just-starts-wit) – Alex K. May 10 '16 at 16:35
  • Yes this is really similar. But I would like something way more simple that what the "answer" post is. Any ideas? – larin555 May 10 '16 at 16:40

0 Answers0