<html>
<body>
<input type="number" id="myNumber" value="2">
<p>Click the button to disable the number field.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("myNumber").disabled = true;
}
</script>
</body>
</html>