HTML <input> Tag with the 'max' Attribute
<form name="myForm" action="http://www.htmlcodes.ws/resources/html-forms-action.cfm">
<input type="number" max="200" name="myField" value="300">
<button>Submit</button>
</form>
The above example demonstrates usage of the <input>
element with the max
attribute.
The max
attribute allows you to restrict the value that the user can input. Specifically, it allows you to specify a maximum value that the user can input.
If specified, the max
attribute must have a value that is a valid floating-point number.
The above example uses an input control with type="number"
however, the max
attribute can be used with other input types, such as range
, month
, week
, time
and others.
You can also use min
to specify a minimum value.