Javascript examples for DOM HTML Element:Input Text
Input Text placeholder Property - Get the placeholder text of a text field:
<!DOCTYPE html> <html> <body> First Name: <input type="text" id="myText" placeholder="Name"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w . j a v a2 s.co m var x = document.getElementById("myText").placeholder; document.getElementById("demo").innerHTML = x; } </script> </body> </html>