Select dropdowns (select and option)

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Select dropdowns (select and option)

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which element creates the dropdown container?
A <select>
B <dropdown>
2. What does the value attribute on <option> provide?
A The data sent to the server when the form submits
B The text the user sees in the dropdown
3. True or false: <SELECT> with capital letters is valid HTML.
A True
B False
4. Which attribute pre-selects an option when the page loads?
A default
B selected
5. True or false: a <select> without a name attribute sends its value on form submission.
A False
B True

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1<select name="colour"> <option value="red">Red</option> <option value="blue">Blue</option> </select> AA dropdown with two options — name on select identifies the submission key; value on option is the submitted data
2<option value="au" selected>Australia</option> BTag names must be lowercase — <SELECT> and </SELECT> should be <select> and </select>
3The value attribute on <option> is the data submitted — the visible text is just the label CThe option is missing its value attribute — without value, the visible text is submitted instead of a clean data value
4<select> needs name and each <option> needs value for the dropdown to be useful in a form DThe selected attribute marks this option as the default choice when the page loads
5<SELECT name="role"> <option value="a">Admin</option> </SELECT> E<select name="size"> <option value="s">Small</option> <option value="l">Large</option> </select>
6<select name="size"> <option>Small</option> </select> F<option value="m">Medium</option>

Definitions

<option>

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
<______ name="colour"> <option value="red">Red</option> </select>
2.
<select name="size"> <______ value="s">Small</option> </select>
3.
<option _____="red">Red</option>
4.
<select name="role"> <option value="a">Admin</option> </______)
5.
<select name="lang"> <option value="en">English</______> </select>

Spot the Error

Shade in the letter of the line that contains an 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</option
E </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</option
F </select>

Answer Key

Select dropdowns (select and option)
Section A: Quick Questions
Q1
A — <select>
Q2
A — The data sent to the server when the form submits
Q3
B — False
Q4
B — selected
Q5
A — False
Section B: Match the Pairs
Q1
<select name="colour"> <option value="red">Red</option> <option value="blue">Blue</option> </select> → A dropdown with two options — name on select identifies the submission key; value on option is the submitted data
Q2
<option value="au" selected>Australia</option> → The selected attribute marks this option as the default choice when the page loads
Q3
The value attribute on <option> is the data submitted — the visible text is just the label → <option value="m">Medium</option>
Q4
<select> needs name and each <option> needs value for the dropdown to be useful in a form → <select name="size"> <option value="s">Small</option> <option value="l">Large</option> </select>
Q5
<SELECT name="role"> <option value="a">Admin</option> </SELECT> → Tag names must be lowercase — <SELECT> and </SELECT> should be <select> and </select>
Q6
<select name="size"> <option>Small</option> </select> → The option is missing its value attribute — without value, the visible text is submitted instead of a clean data value
Section C: Definitions
Q1
<option> — An HTML element placed inside <select> to provide one choice in a dropdown. Its value attribute is sent when the form submits; its text content is what the user sees.
Section D: Fill in the Blanks
Q1
<select name="colour"> <option value="red">Red</option> </select>
Q2
<select name="size"> <option value="s">Small</option> </select>
Q3
<option value="red">Red</option>
Q4
<select name="role"> <option value="a">Admin</option> </select>
Q5
<select name="lang"> <option value="en">English</option> </select>
Section E: Spot the Error
Q1
A — HTML tag names must be lowercase. <SELECT> should be written as <select>.
Q2
B — HTML tag names must be lowercase. <OPTION> and </OPTION> should be <option> and </option>.
Q3
C — Attribute values must be in double quotes: value="nz", not value=nz without quotes.
Q4
D — The last option's closing tag is missing its > angle bracket. It should be </option>.
Q5
E — The last option's closing tag is missing its > angle bracket. It should be </option>.