Number format in Input Element

I’m attempting to format the value of an input element, but cannot manage to do it. I have tried the methods discussed in this forum (toLocaleString, parseInt, regex) without success. If I console.log the number using Intl.NumberFormat then I get the result I want (e.g. 60,000.00) but I can’t manage to get the same result into the input element.

Here is my code:

export function annualSalary_keyPress(event) {

    setTimeout(insert_gross, 2500);
}

function insert_gross() {
 let yg = $w("#yearlyGross").value;
 
    console.log(new Intl.NumberFormat("en-GB", { minimumFractionDigits: 2 }).format(yg));

        $w("#yearlyGross").value = $w("#annualSalary").value;
        $w("#monthlyGross").value = Number(yg / 12);
        $w("#weeklyGross").value = Number(yg / 52);
        $w("#dailyGross").value = Number(yg / 260);

    }

Any advice would be appreciated.

Are you trying to create a validation ?

What is the value which will be typed in ? —> for example —> 70000 ?
And this should then turn into —> 70.000,00?
Can you also add the link to the post which you mentioned in your first post?

It’s more just formatting as opposed to validation.
I want the formatting to be like this: entered 70000 - output 70,000.00
100000 - 100,000.00
6000 - 6,000.00 etc.
Any value from 100+ can be entered by users.

Here is the link: https://www.wix.com/corvid/forum/community-discussion/how-to-display-numbers-with-a-comma-separator

Hi Dean, did you find a solution. I 'd like to do the same, any advice?

Hi Dean, did you find a solution. I 'd like to do the same, any advice?