Radio buttons
When you wish for only one option to be selected, you can use radio buttons. This requires the introduction of yet another attribute: the name attribute (name
) assigns the same value to all related radio buttons.
Each radio button is an input element with a type attribute of value radio
and a name attribute of value matching all related buttons, so that only one with that name value can be chosen.
Like for checkboxes, the value input attribute attaches a value to a radio button that can be used by JavaScript. In the JavaScript lesson on radio buttons, you can see this example in action.
Note:
Hints:
- undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX