Multiply does not work now

Hi want to get millions, thousands, hundreds, but after the . it must keep it like it is (12,333,444.003838)
I can get the first part is working, but I cannot get the second part to multiply

<font color="red"><b><label for="firstNum">CURRENCY:</label></b></font>
<input type="number" id="firstNum" name="firstNum">

<font color="PURPLE"><b><label for="secondNum">Total </label></b></font>
<input type="number" id="secondNum" name="secondNum">

<button onclick="multiply()">Multiply</button>

<font color="BLUE"><b><label for="result">Total</label></b></font>
<input type="text" id="result" name="result"/>

function multiply(){
	num1 = document.getElementById("firstNum").value;
	num2 = document.getElementById("secondNum").value = 1154.69514250;
	result = num1 * num2;
	document.getElementById("result").value = result.toLocaleString('en-US');


<font color="red"><b><label for="usd">leave blank( info from 1 total</label></b></font>
<input type="usdzar" id="usd" name="usd">

<font color="PURPLE"><b><label for="zar">Put ZAR in</label></b></font>
<input type="usdzar" id="zar" name="zar">

<button onclick="multiply1()">Multiply</button>

<font color="BLUE"><b><label for="result1">Total</label></b></font>
<input type="text" id="result1" name="result1"/>

function multiply1(){
	num3 = document.getElementById("result").value;
	num4 = document.getElementById("zar").value;
	result1 = num3 * num4;
	document.getElementById("result1").value = result.toLocaleString('en-US');

It’s not abundantly clear what you want here.

I infer that you want the comma separators added in, but you want the decimal portion left untouched.

What you are seeing is a result of the formatting method you are calling:

// "1,154.695"

When I look in the docs, I see that you can pass in options:

    minimumFractionDigits: 2,
    maximumFractionDigits: 8,
// "1,154.6951425"

I would mess around with those.

Thank you, I did get it to show in my first part, when I click multiply it shows it correct, but in the second part, i need this.

in first input (second part), it must use the output (first part) then in second part it must multiply output (first part)

1 st part
currency (put 1 in) !st Total(leave blank) 3rd Total (multiply (currency and total)

2nd part

Leave first one empty, second part (ZAR)(use any amount ) and total output must be =(multiply total of 1st part and Zar in second part.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.