Javascript examples for DOM HTML Element:Input Number
The type property returns the type of form element week field.
For an input number, it will always return "number".
A String, representing the type of form element the number field is
The following code shows how to return which type of form element the number field is:
<!DOCTYPE html> <html> <body> <input type="number" id="myNumber" value="2"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*w ww. j a v a 2s. c o m*/ var x = document.getElementById("myNumber").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>