Input Number step Attribute

Definition and Usage

step The attribute sets or returns the value of the step attribute of the numeric field.

The HTML step attribute specifies the valid number interval of the numeric field.

Example: If step="3"If so, the valid numbers can be -3, 0, 3, 6, and so on.

Tip:The step attribute can be used with max and min Use attributes together to create a series of valid values.

See also:

HTML Reference Manual:HTML <input> step Attribute

Example

Example 1

Get the valid number interval of the numeric field:

var x = document.getElementById("myNumber").step;

Try it yourself

Example 2

Change the valid number interval of the numeric field:

document.getElementById("myNumber").step = "5";

Try it yourself

Syntax

Return the step attribute:

numberObject.step

Set the step attribute:

numberObject.step = number

Attribute Value

Value Description
number Specifies the valid numeric interval for a numeric field. The default is 1.

Technical Details

Return Value: A string value that represents the valid numeric interval for a numeric field.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support