Name

value — NN 2 IE 3 DOM 1

Synopsis

Read/Write

Current value associated with the form control that is submitted with the name/value pair for the element. All values are strings, which means that scripts using text field values for some math operations (especially addition) have to convert the strings to numbers via the parseInt( ) or parseFloat( ) functions before performing the math. If you assign a number to a text field’s value property, the browser automatically converts its data type to a string.

Example

document.forms[0].myText.value = "franken"

Value

String.

Default

None.

Get Dynamic HTML: The Definitive Reference 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.