Get the legal number intervals for a number field:
The result of x will be:
The step property sets or returns the value of the step attribute of a number field.
The step attribute specifies the legal number intervals for a number field.
Example: if step="3", legal numbers could be -3, 0, 3, 6, etc.
Tip: The step attribute can be used together with the max and min attributes to create a range of legal values.
The step property is supported in all major browsers.
Note: The step property is not supported in Internet Explorer 9 and earlier versions.
Return the step property:
Set the step property:
Value | Description |
---|---|
number | Specifies the legal number intervals for the number field. Default is 1 |
Return Value: | A String, representing the legal number intervals for the number field |
---|
Change the legal number intervals for a number field:
HTML reference: HTML <input> step attribute