Error entering HTML5 number

I am trying to use the new HTML5 number for user input price. I want the step to be "0.01". This should be pretty simple, and my code is as follows:

<input type="number" step="0.01" />

Well, if you click on the arrows a little, you get type 1.1400000000000001numbers or type numbers 1.1that both don't make sense for dollars.

Does anyone know how to make a number field an actual step of 0.01 and have a consistent number of significant digits? Or, if someone has a more elegant solution that allows users to enter prices, I would like to hear that.

thank

+3
source share
2 answers

, , Html 5 , , , , .

, , JavaScript / - , click / .

+2

JavaScript,

0

Source: https://habr.com/ru/post/1788392/


All Articles