<!DOCTYPE html>
<html>
<body>
Number: <input type="number" id="myNumber" value="2">
<p>Click the button to display the default value of the number field.</p>
<button type="button" onclick="myFunction()">Try it</button>
<p><strong>Note:</strong> input elements with type="number" are not supported in IE 9 and earlier versions.</p>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myNumber").defaultValue;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>