HTML <input type="number">
Example
Define a field for entering a number (You can also set restrictions on what numbers are accepted):
Quantity (between 1 and 5): <input type="number" name="quantity" min="1" max="5">
Try it Yourself »
Definition and Usage
The <input type="number"> defines a field for entering a number.
Use the following attributes to specify restrictions:
- max - specifies the maximum value allowed
- min - specifies the minimum value allowed
- step - specifies the legal number intervals
- value - Specifies the default value
Browser Support
Attribute | |||||
---|---|---|---|---|---|
type="number" | Yes | Yes | Yes | Yes | Yes |
Syntax
<input type="number">