1

Is there some way to make autocompleting by the first letter for select dropdown list not on jQuery but on PURE JavaScript? Something like [only example !!!]:

<input type="text" onkeyup="autoComplete();" />
<select id="mySelectDropdwonList">
  <option>John</option>
  <option>Michael</option>
  <option>Toml</option>
</select>

<script type="text/javascript">
function autoComplete() {
  // what is the code ??
}
</script>

It should work like the jQuery-solution by the link http://harvesthq.github.io/chosen/ but on pure JS

stckvrw
  • 1,689
  • 18
  • 42

1 Answers1

6

A solution just in HTML5:

<input type="text" list="mySelectDropdwonList" />
<datalist id="mySelectDropdwonList">
    <option>John</option>
    <option>Michael</option>
    <option>Toml</option>
</datalist>
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392
  • Thanks, you're the only one who really read the question – stckvrw Oct 08 '15 at 20:46
  • maybe an other answer of me is enlighten you too: http://stackoverflow.com/questions/29154877/use-html5-datalist-autocomplete-with-contains-approach-not-just-starts-wit/32394157#32394157 – Nina Scholz Oct 08 '15 at 20:51