Addition of numbers not displaying on page

I have 3 text input elements. Two of the input fields are populated with numbers from a dropdown change event. In the third input I want to have the sum of the other two fields. The problem is that the result of the addition does not display in the 3rd field.

Here is my code:

export function update_click(event) {
    value = Number($w("#depositAmt").value);
    value1 = Number($w("#firstMonthAmt").value);
    value2 = Number($w("#depositTotal").value);

    value2 = value + value1;
    console.log(typeof value2, value2);
    console.log(typeof value, value);
    console.log(typeof value1, value1);
}

The output in the console is what I want in ‘depositTotal’ but cannot get it like that on the page.
This is what is logged in the console:


Any advice appreciated.

Your code isn’t setting the depositTotal field. You will want to do something like this:

$w("#depositTotal").value = '' + value2;

Note: a null string ‘’ is added to value2 to force it to be a string instead of a number.

I’ve changed my code:

export function update_click(event) {
    value = $w("#depositAmt").value;
    value1 = $w("#firstMonthAmt").value;
    value2 = value + value1;

    $w("#depositTotal").value = '' + value2;

    console.log(typeof value2, value2);
    console.log(typeof value, value);
    console.log(typeof value1, value1);
}

In the console I have:

I still have nothing on the actual page.

Is depositTotal a text input field, or a plain text field?

You still need to convert the fields to numbers in order to perform the addition:

let value = Number($w("#depositAmt").value);
let value1 = Number($w("#firstMonthAmt").value);
let value2 = value + value1;

// the next line depends on what type of text element you're using
$w("#depositTotal").value = value2; // for input field
$w("#depositTotal").text = value2;    // for text field

Also, as stated in the Forum Policies and Guidelines , do not post in ALL CAPS. That means both the Title and the post itself.

Thank you very much for your help. That solved the problem.

Ok, apologies. I have corrected.