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.