input number max
snippet in html

input number max

user1608

<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5"><br><br>

html restrict input to numbers

user2536

<input type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" />

number input html

user9474

<input id="number" type="number" value="42">