Change the maximum value:
document.getElementById("myNumber").max = "10";
Click the button to change the value of the max attribute of the number field.
<!DOCTYPE html> <html> <body> Quantity://from www .j a v a2s .com <input type="number" id="myNumber" min="1" max="5"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myNumber").max = "10"; document.getElementById("demo").innerHTML = "The value of the max attribute was changed."; } </script> </body> </html>