Get the placeholder text of an email field:
var x = document.getElementById("myEmail").placeholder;
Click the button to display the placeholder text of the email field.
<!DOCTYPE html> <html> <body> Login: <input type="email" id="myEmail" placeholder="Email"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from ww w. j av a2 s .co m var x = document.getElementById("myEmail").placeholder; document.getElementById("demo").innerHTML = x; } </script> </body> </html>