Validates usage of input attributes
- Rule ID:
- input-attributes
- Category:
- Content model
- Standards:
- HTML5
The <input>
element uses the type
attribute to set what type of input field it is.
Depending on what type of input field it is many other attributes is allowed or disallowed.
For instance, the step
attribute can be used with numerical fields but not with textual input.
This rule validates the usage of these attributes, ensuring the attributes are used only in the proper context.
See HTML5 specification for a table of attributes and types.
Rule details
Examples of incorrect code for this rule:
<input type="text" step="5">
Examples of correct code for this rule:
<input type="number" step="5">
Version history
- 8.15.0 - This rule no longer checks the
autocomplete
attribute, usevalid-autocomplete
instead. - v4.14.0 - Rule added.