I can't find out how to define a step value and a precision to a input[number]
1.01
is considered as invalid until I specify a step of 0.01
.
But In that case I can't specify a specific step.
Same issue with big number. If I specify a step of 1000
and the user type 1001
the value is considered invalid...
You can have a look to this example
Take a look at the Definition and Usage of the
step
attribute:Once it is out of the intervals, the number is illegal.
Try using Javascript code to take care of your need.
You probably just need to define a correct step and an initial value that suits your purpose.
The role of the
value
attribute is not fully explained in thestep
attribute documentation http://www.w3schools.com/tags/att_input_step.asp.In the first input in your example, attributes are set to
value = 1.01
andstep = 1
(default value). The input will accept the following values:1.01 + 1n
. wheren
is an integer value. Example of accepted values are: 1.01, 2.01, 3.01 and so on, as well as -0.99, -1.99 -1.99 and so on.As a general rule, the accepted values will be:
Where .
You can have an idea of the accepted values by using the UP/DOWN arrow keys when the input is focused.
As suggested in previous answers,
step="any"
will disable the step validation, it won't disable the stepper functionality (step
will defaults to 1), but will require to implement the step validation by hand.I guess you want to disable step validation. If so,
step="any"
should work.