Input Checkbox value Property
Return the value of the value attribute of a checkbox:
The result of x will be:
Definition and Usage
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).
Return the value property:
Set the value property:
|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:
document.getElementById("demo").innerHTML = "The value of the value attribute was changed. Try to submit the form again.";
HTML reference: HTML <input> value attribute
❮ Input Checkbox Object