Get the placeholder text of a URL field:
var x = document.getElementById("myURL").placeholder;
Click the button to display the placeholder text of the URL field.
elements with type="url" are not supported in Safari.
<!DOCTYPE html> <html> <body> Homepage: <input type="url" id="myURL" placeholder="Address of web site"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w . jav a 2s.c o m*/ var x = document.getElementById("myURL").placeholder; document.getElementById("demo").innerHTML = x; } </script> </body> </html>