Input Email placeholder Attribute

Definition and Usage

placeholder Sets or returns the value of the placeholder attribute of the email field.

The HTML placeholder attribute specifies a brief hint that describes the expected value of the email field (for example, a sample value or a brief description of the expected format).

A short hint is displayed in the text field before the user enters a value.

See also:

HTML Reference Manual:HTML <input> placeholder Attribute

Example

Example 1

Change the placeholder text of the email field:

document.getElementById("myEmail").placeholder = "Your Email address";

Try it yourself

Example 2

Get the placeholder text of the email field:

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

Try it yourself

Syntax

Return the placeholder attribute:

emailObject.placeholder

Set the placeholder attribute:

emailObject.placeholder = text

Attribute Value

Value Description
text Specifies a brief hint (word or phrase) describing the expected value of the email field.

Technical Details

Return Value: A string value that represents a brief hint for the expected value of the email field.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support