Textarea placeholderProperty

Textarea 对象参考手册Textarea Object


Example

Modify the placeholder (expected value) property of textarea:

document.getElementById("myTextarea").placeholder = "Enter search keywords...";

Try it Yourself »

Definition and Usage

The placeholder property sets or returns the value of the placeholder attribute of the textarea element.

The placeholder attribute specifies a short hint that describes the expected value of the textarea element.

The placeholder displays a short hint when the textarea element's value is empty, and disappears when the textarea element gains focus.



Browser Support

Property
placeholder Yes 10.0 Yes Yes Yes

Syntax

Return the placeholder property:

textareaObject.placeholder

Set the placeholder property:

textareaObject.placeholder = text


Property Values


Value Description
number

A string representing the expected value of the textarea element.



Technical Details

Return Value: A string, the expected value of the textarea element.

More Examples

Example

Get the placeholder (expected value) property value of the textarea:

var x = document.getElementById("myTextarea").placeholder;

Try it Yourself »


Textarea 对象参考手册Textarea Object

Other Extensions