Group two options under a labelled heading.
Acceptance criteria
- 1.Group two options under a labelled heading.
HTML Tutorial · HTML Tags
These 10 tasks go with the HTML <optgroup> Tag chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “The tag is used to group related elements inside a drop-down. It provides better organization and readability for long lists of options. can only be used as a child of .” .
1.Group two optionsexercise · easy · 10 min
Group two options under a labelled heading.
Passes when: Group two options under a labelled heading.
2.Two groupsexercise · easy · 10 min · practice plan
Add two labelled groups to the dropdown.
Passes when: Add two labelled groups to the dropdown.
3.Disable a groupexercise · easy · 10 min · practice plan
Make one whole group unavailable.
Passes when: Make one whole group unavailable.
4.An ungrouped option tooexercise · easy · 10 min · practice plan
Add a group plus one option outside it.
Passes when: Add a group plus one option outside it.
5.A grouped city pickerexercise · medium · 10 min · practice plan
Build a named dropdown with two labelled groups.
Passes when: Build a named dropdown with two labelled groups.
6.Fix the group with no labelbug fix · easy · 8 min
An option group needs a label to be useful.
Passes when: An option group needs a label to be useful.
7.Fix the missing second groupbug fix · easy · 8 min · practice plan
The Indian cities have no group.
Passes when: The Indian cities have no group.
8.Fix each option disabled separatelybug fix · easy · 8 min · practice plan
The group itself can be disabled in one place.
Passes when: The group itself can be disabled in one place.
9.Fix the label written as an optionbug fix · easy · 8 min · practice plan
A group heading is the optgroup's label.
Passes when: A group heading is the optgroup's label.
10.Fix the dropdown missing its namebug fix · easy · 8 min · practice plan
The choice cannot be submitted without a name.
Passes when: The choice cannot be submitted without a name.
Between them these tasks cover Grouping options, label attribute and Long dropdowns.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.