Attribute: Step

The step attribute specifies the legal number intervals for an <input> element. A tip is to use the step attribute together with the max and min attributes to create a range of legal values. The step attribute works with the following input types: number, range, date, datetime, datetime-local, month, time and week.

For example: if step="3", legal numbers could be -3, 0, 3, 6, etc. for this document which shows an input field with such specified legal number intervals:

HTML file: Displayed by browser:
<form action="http://www.w3schools.com/html/action_page.php">
<small>Number divisible by 3:</small>
<br /><input type="number" name="points" step="3">
<br />
<br /><input type="submit"
</form>
Number divisible by 3:


This attribute is compatible with most major browsers, except Firefox.

Back button Table of Contents Next button