Hello, Please anyone who can help me correct this code, i need the three results to show immediately when the button is clicked, but it only shows the first result on click, until you you click the button again before it shows the second result and again before it shows the third
Please help me i want it to show at once
export function button36_click ( event ) {
**let** num = Number ( $w ( "#input8" ). value );
let num1 = Number ( $w ( “#input7” ). value ); let num2 = Number ( $w ( “#text157” ). text ); let feeee = Number ( $w ( “#text159” ). text ); let servfee = Number ( $w ( “#text158” ). text );
$w ( “#text157” ). text = " " +( num * num1 );
$w ( “#text158” ). text = " " +( feeee * num2 );
$w ( “#text160” ). text = " " +( servfee + num2 );
let num = Number ( $w ( “#input8” ). value ); let num1 = Number ( $w ( “#input7” ). value );
$w ( “#text157” ). text = " " +( num * num1 ); let num2 = Number ( $w ( “#text157” ). text ); let feeee = Number ( $w ( “#text159” ). text );
$w ( “#text158” ). text = " " +( feeee * num2 ); let servfee = Number ( $w ( “#text158” ). text );
$w ( “#text160” ). text = " " +( servfee + num2 );
The problem lies with the fact that you assign your text to a variable before there is any value on the textfield.
Math.ceil(yourNumberHere) will round it up
Math.floor(yourNumberHere) will round it down
Math.round(yourNumberHere) will round it to the nearest whole number
so 1.3 will be 1 and 1.6 will be 2