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