i have inputs in html form using javascript autofill inputs on changes
the problem follow code show decimals longer decimals 42880.34623465464356435634 code is:
thetotal.value = parsefloat(total.value) * (1.00/1.19);
this code price less taxes total , works, show me decimals...
what need price in example:
42880
without dots or commas . or , 42.880 or 42,880 , absolutly not 42880.34623465464356435634
i want show 42880
tried .round this:
thetotal.value = parsefloat(total.value) * (1.00/1.19).round(2);
.round(2) reason addeventlistener stop working input when using .round(2)
user parseint function it. below :
thetotal.value = parseint(parsefloat(total.value) * (1.00/1.19));
you integer output.
another way math.round. below :
thetotal.value = math.round(parsefloat(total.value) * (1.00/1.19));
Comments
Post a Comment