Select dropdowns (select and option), online
Six activities your students do on their own devices. See who's finished, and their scores.
Select dropdowns (select and option) in one minute
What students need to know
value="m" is what gets sent to the server. 'Medium' is the human-readable label the user sees in the dropdown. name on select and value on each option together make the form submission meaningful — size=s or size=l.
<select> is the HTML element for dropdowns. <dropdown> is not a valid HTML element. The value attribute holds the submitted data. The visible text is placed between the <option> and </option> tags.
Mistakes students make
- HTML tag names must be lowercase. <SELECT> should be written as <select>.
- HTML tag names must be lowercase. <OPTION> and </OPTION> should be <option> and </option>.
- Attribute values must be in double quotes: value="nz", not value=nz without quotes.
- The last option's closing tag is missing its > angle bracket. It should be </option>.
What students will learn in this module
Every question in Module 32
Quick questions
- Which element creates the dropdown container?A<select>B<dropdown>
- What does the value attribute on <option> provide?AThe data sent to the server when the form submitsBThe text the user sees in the dropdown
- True or false: <SELECT> with capital letters is valid HTML.ATrueBFalse
- Which attribute pre-selects an option when the page loads?AdefaultBselected
- True or false: a <select> without a name attribute sends its value on form submission.AFalseBTrue
Key terms
Students type the meaning of:
<option>
Match the pairs
<select name="colour"> <option value="red">Red</option> <option value="blue">Blue</option> </select>Match it to what it does
<option value="au" selected>Australia</option>Match it to what it doesThe value attribute on <option> is the data submitted — the visible text is just the labelMatch it to what it does<select> needs name and each <option> needs value for the dropdown to be useful in a formMatch it to what it does<SELECT name="role"> <option value="a">Admin</option> </SELECT>Match it to what it does
<select name="size"> <option>Small</option> </select>Match it to what it does
Fill in the blanks
<______ name="colour"> <option value="red">Red</option> </select>
Hint: Type the element name that creates a dropdown list
<select name="size"> <______ value="s">Small</option> </select>
Hint: Type the element name used for each item in a dropdown list
<option _____="red">Red</option>
Hint: Type the attribute name that holds the submitted value for this option
<select name="role"> <option value="a">Admin</option> </______)
Hint: Type the element name for the closing tag of a dropdown list
<select name="lang"> <option value="en">English</______> </select>
Hint: Type the element name for the closing tag of a dropdown option
Spot the error
Question 1
A<SELECT name="colour">B <option value="red">Red</option>C <option value="blue">Blue</option>D</select>
Question 2
A<select name="size">B <OPTION value="s">Small</OPTION>C <option value="m">Medium</option>D</select>
Question 3
A<select name="country">B <option value="au">Australia</option>C <option value=nz>New Zealand</option>D <option value="uk">UK</option>E</select>
Question 4
A<select name="role">B <option value="admin">Admin</option>C <option value="user">User</option>D <option value="guest">Guest</optionE</select>
Question 5
A<form>B <select name="lang">C <option value="en">English</option>D <option value="fr">French</option>E <option value="de">German</optionF </select>
