Form input type step attribute understanding problem

Is there any brother or sister who can make me easy to understand a topic called HTML form input types to attribute called “step”? I am not understanding the “step” properly.
Please explain in an easy way.

Thanks in advance.

The step attribute belongs to the <input> element with the attribute type=number.

When you have an input with a type of number, than it is designed to take in a number value, and most modern browsers (if not all) place two arrows somewhere on the input box that you can click to increment or decrement to number value in it. By default the increment or decrement is 1. So if the value is zero and you hit the up arrow the number becomes 1 and if you hit the down arrow you get -1.

The step attribute allows you to change this so that clicking the arrows increments and decrements by a different value. For example:

<input type=number step=3>

Hitting the up arrow on this form would add 3 to the number value it already holds, and hitting the down arrow would subtract 3 from the value it holds.

You can read more about the step attribute, and the rest of <input> in the MDN documentation:

3 Likes

Thanks a lot for your detailed explanation.

May I know hat Can I change the step value to any number and why or why not?

1 Like

To my knowledge you can use any positive integer:

7, 14, 10036

You can also use decimal numbers and numbers with exponents:

7.5

10e+7

1 Like

Thanks a lot again <3

1 Like