Example
Get the legal number intervals for a number field:
var x = document.getElementById("myNumber").step;
The result of x will be:
3
Try it Yourself »
Definition and Usage
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.
Browser Support
The step property is supported in all major browsers.
Note: The step property is not supported in Internet Explorer 9 and earlier versions.
Syntax
Return the step property:
numberObject.step
Set the step property:
numberObject.step=number
Property Values
Value | Description |
---|---|
number | Specifies the legal number intervals for the number field. Default is 1 |
Technical Details
Return Value: | A String, representing the legal number intervals for the number field |
---|
More Examples
Example
Change the legal number intervals for a number field:
document.getElementById("myNumber").step = "5";
Try it Yourself »
Related Pages
HTML reference: HTML <input> step attribute
< Input Number Object