Skip to main content
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 Internet 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