HTML | DOM Input Email Placeholder Property
The DOM Input Email Placeholder Property is used to set or return the value of a placeholder attribute of an Email Field. The placeholder attribute specifies a short hint that describes the expected value of a input field / textarea. The short hint is displayed in the field before the user enters a value.
Syntax:
- It is used to return the placeholder property.
emailObject.placeholder
- It is used to set the placeholder property.
emailObject.placeholder = text
Property Value:
- text: It defines a short hint that describes a expected value of the Email Field.
Return Value: It returns a string value which represents a short hint that describes the expected value of the Email Field.
Example-1: This example illustrates how to return the property.
<!DOCTYPE html> <html> <head> <title> HTML DOM Input Email placeholder Property </title> </head> <body STYLE="TEXT-ALIGN:CENTER;"> <h1> GeeksforGeeks</h1> <h2>DOM Input Email placeholder Property</h2> E-mail: <input type="email" id="email" name="myGeeks" placeholder="careers@geeksforgeeks.org"> <BR><br> <button onclick="myGeeks()"> Click Here! </button> <p id="GFG" style="font-size:20px;color:green;"></p> <!-- Script to access input element with type email attribute --> <script> function myGeeks() { <!--return the placeholder Property --> var em = document.getElementById("email").placeholder; document.getElementById("GFG").innerHTML = em; } </script> </body> </html> |
Output:
Before clicking on the button:

After clicking on the button:

Example-2 : This example illustrates how to set the property.
<!DOCTYPE html> <html> <head> <title> HTML DOM Input Email placeholder Property </title> </head> <body STYLE="TEXT-ALIGN:CENTER;"> <h1> GeeksforGeeks</h1> <h2>DOM Input Email placeholder Property</h2> E-mail: <input type="email" id="email" name="myGeeks" placeholder="careers@geeksforgeeks.org"> <BR><br> <button onclick="myGeeks()"> Click Here! </button> <p id="GFG" style="font-size:20px;color:green;"></p> <!-- Script to access input element with type email attribute --> <script> function myGeeks() { <!--setting the multiple Property --> var em = document.getElementById("email").placeholder = "Input Your Email Address"; document.getElementById("GFG").innerHTML = "The value of the placeholder attribute was changed to :" + em; } </script> </body> </html> |
Output:
Before clicking on the button:

After clicking on the button:

Supported Browsers: The browser supported by DOM input Email placeholder Property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Input URL placeholder Property
- HTML | DOM Input Text placeholder Property
- HTML | DOM Input Search placeholder Property
- HTML | DOM Input Number placeholder Property
- HTML | DOM Input Password placeholder Property
- HTML | DOM Input Email value Property
- HTML | DOM Input Email name Property
- HTML | DOM Input Email multiple Property
- HTML | DOM Input Email pattern Property
- HTML | DOM Input Email defaultValue Property
- HTML | DOM Input Email autofocus Property
- HTML | DOM Input Email form Property
- HTML | DOM Input Email disabled Property
- HTML | DOM Input Email maxLength Property
- HTML | DOM Input Email autocomplete Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh



