Sets or retrieves the initial value of the text field.
Different from the value property. The placeholder property only displays an initial value for the control. The initial value is not the value of the control, it is only a text that is displayed initially in the element. When the control gets the focus, the initial value disappears.
If you need an example that implements the functionality of the placeholder property in all commonly used browsers, see Example 3.
You can find the related objects in the Supported by objects section below.
This property is read/write.
|HTML page for this property: placeholder|
String that sets or retrieves the initial value.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the placeholder attribute:
Example HTML code 2:
This example modifies the value of the placeholder property:
Example HTML code 3:
This cross-browser example implements the functionality of the placeholder property:
User Contributed Comments