What is the use of step attribute in <input> tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of step attribute in <input> tag?

Example from a quiz question: <input type="number" name="values" min="0" max="30" step="7" value="0"> Please explain me this code and also about these combinations: 14, 0, 28, 7, 17 0, 21, 7, 28, 14 7, 23, 14, 0, 28 30, 0, 7, 28, 14 Why was second one the right answer?

25th Apr 2018, 12:31 PM
Kawalpreet Juneja
Kawalpreet Juneja - avatar
3 Answers
+ 8
when you have input type number, on the input field in the right you have 2 arrows - to increase and to decrease. and the step means how big should the increase or decrease be. So for example if you set the step to 5 you increase the number by 5 -- 0,5,10,15,20...
25th Apr 2018, 12:37 PM
Proff
Proff - avatar
+ 1
Thanks Proff
25th Apr 2018, 12:39 PM
Kawalpreet Juneja
Kawalpreet Juneja - avatar
- 1
Profesionals use Tk library for C#,C++,python,java and step +- aren't problem
28th Apr 2018, 8:35 PM
Viktor UHLIAR
Viktor UHLIAR - avatar