I have a fiddle here that removes the last character from the input when the user types .
However it seems .length
ignores the decimal when there are no numbers after it.
For example: currently when the user types 20.
, it will be cut to 2
instead of 20
.
How can I detect this and remove the decimal once the user types it?