Here’s a very short, quick post, detailing a Firefox scripting frustration that I discovered today.
to make sure that the “cents” or “pence” part of the amount is not chopped off, even if zero. In other words, the “toFixed” method converts something like “4” to “4.00” – as long as the value is numeric of course.
Now let’s say that you want to place the value into an HTML5 “number” input so the user can edit it if they want. No problem, assuming you have jQuery available you would use something like:
and the input element would be marked up something like this:
<input type=”number” step=”0.01? name=”my_input” id=”my_input” />
Taking the earlier example, if my_value is “4.00”, you would expect “4.00” to show in the input, right?
The only solution is to change the field type from “number” to “text” – and lose the little up/down arrows in the process. There’s no other way around it. Like I said at the start of this post, very frustrating.
Hopefully this post will prevent someone wasting an hour on this problem, like I did.