Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Email placeholder property

Input Email placeholder property

Input Email Object Reference Input Email Object

Example

Modify the placeholder hint of the expected value for the email field:

document.getElementById(

"myEmail"

).placeholder =

"Your Email address"

;

Try it »


Definition and usage

The placeholder property is used to set or return the value of the placeholder attribute of the email field.

The placeholder property provides hint text that describes the expected value of the input field.

This hint is displayed when the input field is empty and disappears when the field gains focus.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the placeholder property.

Note: Internet Explorer 9 and earlier IE versions do not support the placeholder property.


Syntax

Return the placeholder property:

emailObject

.placeholder

Set the placeholder property:

emailObject

.placeholder=

text

Attribute values

Value Description
text Describes the hint text of the expected value of the input field

Technical Details

Return Value: String, representing the hint text of the expected value of the input field

More examples

Example

Get the expected value of the email field:

var

x = document.getElementById(

"myEmail"

).placeholder;

x The output is:

Email

Try it »


Related pages

HTML Reference Manual: HTML placeholder property


Input Email Object Reference Input Email Object