I have been asked for something a bit weird, that the fields input
numeric of a JSP page have 2 decimals by default.
So far everything is normal:
<input type="number" step="0.01" />
Now, the client wants the quantities to ALWAYS have 2 decimal places, even for 0:
should be:
That is, while you use the arrows to increase the quantity or loads from the database a value with zeros in the decimal places that this value is not trimmed (that is, overwrite the default behavior that ignores the zeros to the right)
MVCE
I've tried it with pattern="regex"
:
^\d+\.\d{2}$
\d.{2}$
but it does not seem to work.
ADDED