0

How do you increment a currency fractional part?

For instance, let's say you have 14.0009 and you want to increment it to 14.0010 when press the up arrow key

Khumo Mogorosi
  • 301
  • 2
  • 7
  • I'm afraid it's not clear what you're asking. On the face of it, you just add `0.0001` to the number. Have you had some problem doing that? (For instance, [this one](https://stackoverflow.com/questions/588004/is-floating-point-math-broken)?) If so, you may need a "big decimal" library. (A native one may be coming to JavaScript at some point, but not in the next couple of years.) – T.J. Crowder Sep 03 '20 at 14:23

1 Answers1

3

If you are using a HTML5 Input number field then set the step attribute to step="0.0001".

See more: https://www.w3schools.com/tags/att_input_step.asp
See more: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/step

Zac
  • 118
  • 1
  • 6