The max attribute is used to specify the maximum value allowed for an <input> element. It helps in limiting user input within a defined range.
- Sets the highest value that a user can enter in the input field.
- Commonly used with input types like number, date, range, and datetime-local.
- If the entered value exceeds the maximum limit, the input becomes invalid.
Syntax:
<input max="number|date">
Attribute Values:
- number: It contains the value i.e number which specifies the maximum value allowed by the input field.
- date: It contains the value i.e date which specifies the maximum date allowed for the <input> date field.