From the course: HTML Essential Training
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Checkbox and radio inputs
From the course: HTML Essential Training
Checkbox and radio inputs
- So far, we've used the input element for text-based data, but inputs can also be used to collect information using checkboxes and radio buttons where the user selects a choice rather than inputs text. A checkbox can be used to present one or more options. The user can check or uncheck individual options and select one or more options from the same group. It also needs a label to display a caption and the foreign ID attributes to create the association. Labels are usually placed after the checkbox. A radio button is used to present multiple options where users can select only one choice. Once a radio button is selected, it can only be deselected by choosing another radio button in the same group. It also requires a label. Let's go back to the example. The initial design included a single checkbox. Since we're already collecting an email address, the user can just check the box if they want to opt in to the newsletter. Let's add a div just after the password grouping. Then we'll add…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.