Input Email placeholder Property

Input Email Object Reference Input Email Object

Example

Change the placeholder text of an email field:

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

Try it yourself »

Definition and Usage

The placeholder property sets or returns the value of the placeholder attribute of an email field.

The placeholder attribute specifies a short hint that describes the expected value of an email field (e.g. a sample value or a short description of the expected format).

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The placeholder property is supported in all major browsers.

Note: The placeholder property is not supported in Internet Explorer 9 and earlier versions.


Syntax

Return the placeholder property:

emailObject.placeholder

Set the placeholder property:

emailObject.placeholder=text

Property Values

Value Description
text Specifies a short hint (one word or a short phrase) that describes the expected value of the email field

Technical Details

Return Value: A String, representing a short hint that describes the expected value of the email field

More Examples

Example

Get the placeholder text of an email field:

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

The result of x will be:

Email

Try it yourself »

Related Pages

HTML reference: HTML <input> placeholder attribute


Input Email Object Reference Input Email Object

SHARE THIS PAGE

COLOR PICKER

colorpicker





Search w3schools.com:

Translate w3schools.com: