Text.value

JavaScript1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

							text.value

Description

The value property of an instance of a Text object returns the current value of the text box. Note that this is not the default value that can be accessed via the Text.defaultValue property and is often used to set the value of a text box.

Example

Listing 7.505 contains a text box and button. You can edit the text in the text box and then click the Reset button to reset the text back to the default value.

Listing 7.505 Resetting the Value of a Text Box to the Default Value
 <html> <head> <script language="JavaScript"> <!-- Hide // Reset the text in the text box to its default value. function resetText(){ document.myForm.myText.value = document.myForm.myText.defaultValue; ...

Get Pure JavaScript 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.