Input Number step Property
Example
Get the legal number intervals for a number field:
var x = document.getElementById("myNumber").step;
Try it Yourself »
Description
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
Property | |||||
---|---|---|---|---|---|
step | Yes | 10.0 | Yes | Yes | Yes |
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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.