On my website satoshindex.com when I try and type a number with a decimal point into the top input box, it automatically deletes the decimal point. It also doesn't let me highlight the input with Ctrl-A or use the arrow keys to move to a different digit in the number.
I think it has something to do with accounting.js.
Here is the relevant code from my website:
var SAT = 0.00000001;
var BIT = 0.000001;
var MBIT = 0.001;
var BTC = 1;
var currentUnit = BTC;
I know it has something to do with these lines in the btcConvert
and usdConvert
functions because when I delete them the issue goes away but no commas are used to separate the numbers.
var decimals = decimalPlaces(input.value);
input.value = accounting.formatNumber(input.value, decimals)
I think the issue is that btcConvert is called every time you type in the input box and formatNumber is deleting the decimal place, but without formatNumber in btcConvert I can't get it to add commas to the number when it is above 999, same in USD convert.