Datalist suggestions in HTML
A free-text input with suggestions attached, unlike a select's closed list.
<label for="repo">Repository</label>
<input type="text" id="repo" name="repo" list="known-repos"
placeholder="owner/name">
<datalist id="known-repos">
<option value="python/cpython">
<option value="rust-lang/rust">
<option value="sqlite/sqlite">
</datalist>
How it works
liston the input points at thedatalistid.- The user may still type a value that is not offered.
- The options need no labels, only values.
The run, in numbers
- Lines
- 8
- Characters to type
- 257
- Tokens
- 57
- Three-star pace
- 70 tpm
At the three-star pace of 70 tokens a minute, this run takes about 49 seconds.
Step 5 of 6 in Choices, step 13 of 25 in Forms & inputs.