<input type="radio">
Browser |
|
---|---|
Type |
The INPUT element defines an input field. When you specify "radio" for the type attribute of this element, a radio button is created.
<input type="radio" name="example" value="yes">Yes
<input type="radio" name="example" value="no" checked>No
Attribute | Value | Explanation |
---|---|---|
type=" " | radio | the type of input field |
name=" " | field name | a unique name for the field |
value=" " | initial value | this value is submitted |
checked | checked | that button is checked (HTML : checked | XHTML : checked="checked") |
- type="radio"
- Creates a radio button on the form.
- name=""
- The field name is used to identify the form field. Several radio buttons can share the same field name, and only one can be selected within that.
- value=""
- This value is submitted to the server when selected.
- checked
- That button is checked in the initial state.