Name
Input.value — the value displayed or submitted by a form element
Availability
Netscape 2; buggy in Internet Explorer 3
Synopsis
input
.value
Description
value
is a read/write string property of all form
elements that specifies the value displayed by the form element
and/or submitted for the element when the form is submitted. The
value
property of the Text element, for example,
is the user’s input, which is also the value submitted with the
form. For the Checkbox object, on the other hand, the
value
property specifies a string that is not
displayed but is submitted with the form if the Checkbox element is
checked when the form is submitted.
The initial value of the value
property is
specified by the value
attribute of the HTML tag
that defines the form element.
For Button, Submit, and Reset objects, the value
property specifies the text that appears within the button. On some
platforms, changing the value
property of these
elements actually changes the text displayed by the buttons onscreen.
This does not work on all platforms, however, and is not an advisable
technique. Changing the label of a button may change the size of the
button, causing it to overlap and obscure other portions of the
document.
The Select element has a value
property, like all
form elements, but does not use it. Instead, the value submitted by
this element is specified by the value
property of
the Option objects it contains.
For security reasons, the value
property of the FileUpload element is read-only. ...
Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.