Text.defaultValue

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

							text.defaultValue

Description

The defaultValue property of a Text object instance contains the default value specified by the VALUE attribute of the <input> tag. This property is often used to reset forms to their default values after a user has entered some data.

Example

Listing 7.494 has a text box and a button. If the user edits some of the text in the box and then clicks the Click to Reset button, the text will change back to the default value.

Listing 7.494 Using the defaultValue Property to Set the Value of the Text Box back to Its Original Value
 <html> <head> <script language="JavaScript"> <!-- Hide // Define the resetForm function called by pressing the button ...

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.