Thursday, February 26, 2015

html5 autocomplete without js!

From this codepen.io...  just do something like

<input list="dwarves">

<datalist id="dwarves">
    <option>Doc</option>
    <option>Grumpy</option>
    <option>Happy</option>
    <option>Sleepy</option>
    <option>Bashful</option>
    <option>Sneezy</option>
    <option>Dopey</option>
</datalist>

to get this:

Excellent! I kind of wish I knew an easy way to extend that to multiple entries, like with a tag system.

No comments:

Post a Comment