Javascript examples for DOM HTML Element:Input Text
Input Text defaultValue Property - Get the default value of a text field:
<!DOCTYPE html> <html> <body> Name: <input type="text" id="myText" value="Mickey"> <button type="button" onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from ww w . j av a 2 s.c o m*/ var x = document.getElementById("myText"); var defaultVal = x.defaultValue; document.getElementById("demo").innerHTML = defaultVal; } </script> </body> </html>