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