Input Radio value Property
Example
Get the value of the value attribute of a radio button:
The result of x will be:
Definition and Usage
The value property sets or returns the value of the value attribute of the radio button.
For radio buttons, the contents of the value property do not appear in the user interface. The value property only has meaning when submitting a form. If a radio button is in checked state when the form is submitted, the name of the radio button is sent along with the value of the value property (if the radio button is not checked, no information is sent).
Tip: Define different values for radio buttons in the same group, to identify (on the server side) which one was checked.
Browser Support
Property | |||||
---|---|---|---|---|---|
value | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the value property:
Set the value property:
Property Values
Value | Description |
---|---|
text | Specifies the value associated with the input (this is also the value that is sent on submit) |
Technical Details
Return Value: | A String, representing the value of the value attribute of the radio button |
---|
More Examples
Example
Change the value of the value attribute of a radio button:
Example
Using radio buttons together with a text input field to display the value of the selected radio button:
Related Pages
HTML reference: HTML <input> value attribute
Input Radio Object