Return the value of the value attribute of a checkbox:
The result of x will be:
The value property sets or returns the value of the value attribute of a checkbox.
For checkboxes, 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 checkbox is in checked state when the form is submitted, the name of the checkbox is sent along with the value of the value property (if the checkbox is not checked, no information is sent).
The value property is supported in all major browsers.
Return the value property:
Set the value property:
Value | Description |
---|---|
text | Specifies the value associated with the input (this is also the value that is sent on submit) |
Return Value: | A String, representing the value of the value attribute of the checkbox |
---|
Change the value associated with the checkbox:
Submitting a form - how to change the value associated with the checkbox:
HTML reference: HTML <input> value attribute