I am trying to implement some commas and decimals using autonumeric.js. I have hit a bump or two. When i type text in my first input, i get a comma, and a decimal (yay), but when my calculation happens and auto populates the fourth input, i only get a comma, no decimal. Code is below
And here is what I have so far using autoNumeric.js. Again, the math works fine, but the comma and decimal only works for .num1 but not for .num4. For that one, i only get a comma
$('.num1, .num4').each(function() {
var autoNumericInstance = new AutoNumeric($(this)[0], AutoNumeric.getPredefinedOptions().numericPos.dotDecimalCharCommaSeparator);
});
I posted last week but no luck, so i am giving this another shot. I am trying (and failing) to implement autoNumeric.js into this.
I have a form that does simple math, and i am trying to add commas and decimals for numbers…so 3000 is 3,000 and and a dollar field would be 50.00, or 5,000.00
I have tried and failed, maybe i am not reading the docs properly but cant seem to wrap my head around this. For the example below, the first and last fields would be dollar values. Please assist.
Hi,
I have not used autoNumeric.js. And I am a little confused about the form is actually supposed to work.
I do see that you have a $0.00 on each line. This is a good start…
I would think that you could check the character length before the decimal. If there is no comma, and if the length is more than 4, then insert a comma before the final 3 characters that are in front of the decimal.