Ok. hopefully I won’t confuse anyone. I had code that worked fine. Just not on the Safari browser. I was told Safari doen’t like Math code. See code below…
$w . onReady ( function () {
$w ( ‘#input247’ ). onChange (( Event ) => {
const salesPrice = Math . trunc ( Number ( $w ( ‘#input247’ ). value )) ;
const stdCommission = Math . round ( salesPrice * 0.06 );
const ourCommission = Math . round ( salesPrice * 0.025 );
const savings = stdCommission - ourCommission ;
$w ( '#input247' ). value = **null** ;
$w ( "#text548" ). text = '$' + salesPrice . toLocaleString ();
$w ( "#text549" ). text = '$' + stdCommission . toLocaleString ();
$w ( "#text550" ). text = '$' + ourCommission . toLocaleString ();
$w ( "#text551" ). text = '$' + savings . toLocaleString ();
})
});
I changed the code but the last line (subtraction) is returning a $NaN value. I highlighted problem line code in yellow. See code below…
$w . onReady ( function () {
$w ( “#input247” ). onChange (( Event ) => {
**let** price = Number ( $w ( '#input247' ). value );
**let** traditionalPercent = Number ( $w ( '#text557' ). text );
**let** buyersAgentPercent = Number ( $w ( '#text560' ). text );
**let** traditionalTotal = Number ( $w ( '#text549' ). text );
**let** buyersAgentTotal = Number ( $w ( '#text550' ). text );
$w ( "#input247" ). value = **null** ;
$w ( '#text548' ). text = '$' + price . toLocaleString ();
$w ( '#text549' ). text = '$' + ( price * t raditionalPercent ). toLocaleString ();
$w ( '#text550' ). text = '$' + ( price * buyersAgentPercent ). toLocaleString ();
$w ( '#text551' ). text = '$' + ( traditionalTotal - buyersAgentTotal ). toLocaleString ();
})
});
Can anyone please help with that last line.