Input Number max Property - Change the maximum value: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Number

Description

Input Number max Property - Change the maximum value:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Quantity:/* w ww.  ja v a  2 s.  c om*/
<input type="number" id="myNumber" min="1" max="5">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myNumber").max = "10";
    document.getElementById("demo").innerHTML = "The value of the max attribute was changed from '5' to '10'.";
}
</script>

</body>
</html>

Related Tutorials