STEP 1 · LEARN How it works Connect an input to a datalist of suggestions. Semantic structure should describe meaning, not visual appearance.
<form><label for="city">Locality</label><input id="city" name="city" list="cities"><datalist id="cities"><option value="Chisinau"><option value="Balti"><option value="Cahul"></datalist></form>A datalist holds predefined suggestions, but the user may still type another value. The input list attribute must match the list id, and real suggestions have non-empty values.
<form><input list="cities"><datalist><option value="Chisinau"></datalist></form>The input has no label, id or name, the datalist has no “cities” id, and one option does not form the required suggestion set.
EXPECTED RESULT A labelled input with list="cities" and a datalist#cities containing at least three distinct values.
STEP 2 · APPLY Your exercise Complete the example. Connect an input to a datalist of suggestions.
Code Result
index.html HTML
Exercise code
STEP 4 · CHECK
What needs to pass 0% not checked
○ The input has an id, name and points to the cities datalist. ○ The datalist offers at least three distinct suggestions. ○ The input with suggestions has a label.
Check exercise✓ Show a hint
Explain the solution logic+ Add a label, id and name to the input, set id="cities" on the datalist and provide at least three options with different values.