Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

placeholder attribute | placeholder property

Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.

This property is read/write.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section Explorer 10



<element placeholder="sPlaceholder" ... >


object.placeholder = sPlaceholder
sPlaceholder = object.placeholder


Property values

Type: DOMString

A string containing a prompt or hint text that will be displayed in an input field.

Standards information


The placeholder attribute can be used on text or text area input controls, or with text-based input attributes URL or email. The following example shows the placeholder text on a URL input field.

<label>Enter a URL: <input name="url" type="text" placeholder=" " /></label>

See also




© 2017 Microsoft