HTML form radio
From w3cyberlearnings
Contents |
HTML - Radio Button
Radio button uses for single select option at a time of a limited number of options.
HTML - Syntax Radio Button
<input type="radio" name="NAME_VALUE" value="VALUE"/>Label
Radio Button - Attributes
Attributes | Value | Example | Description |
---|---|---|---|
name | text | <input type="radio" name="gsex">Male | name the radio button |
value | text | <input type="radio" name="gsex" value="male">Male | value of the radio button when submit |
checked | checked | <input type="radio" name="gsex" checked="checked">Male | Default select radio button |
Example 1 TRY-IT
<html> <head> <title>Radio Button</title> </head> <body> <form> <input type="radio" name="fruits" value="apple"/>Apple<br/> <input type="radio" name="fruits" value="banana"/>Banana<br/> <input type="radio" name="fruits" value="coconut"/>Coconut<br/> <input type="radio" name="fruits" value="mango" checked="checked"/>Mango<br/> <input type="radio" name="fruits" value="Orange"/>Orange<br/> </form> </body> </html>
Output
Related Link
- Form Radio
- Form Checkbox
- Form Button
- Form Submit
- Form Reset