When i write my price in Input Box , Need to appear in text field


1- input field box “type number”
2- text field

Need to add Tax on price
like
100 > COST = 115$
50 > COST = 65$

Tax is 15$

Proofed …

Need code .
Thanks

Your problem is exact the case, which is best to learn JS.
Simple mathematic methods, where you only have to put some logic on it…

You have a tax → 15$ ? So declare a new variable → called → tax with value=15…

let tax = 15;

You have an INPUT-FIELD, where you type in your VALUES?

$w('#input1')

You have a TEXT-FIELD where you want to show the RESULT?

$w('#textFieldIDhere')

You want to start some action when the VALUE of the INPUT-FIELD has been changed?

$w('#input1').onChange(()=>{.....});

Put all logic together, it’s not that difficult…

let tax = 15;

$w.onReady(function() {console.log("Page ready!");
    $w('#input1').onChange(()=>{
        let resValue =  $w('#input1').value + tax + "$"
        $w('#textFieldIDhere').text = resValue;
    });
});

Perhaps you should consider to learn some JS-Basics, first.
W3Schools can help! → https://www.w3schools.com/

Perfectly Sir !.
@russian-dima :+1:

have problem if
100> 10015$ ??
50> 5015$
@russian-dima
i need to summation not to add numbers!

The returned type of $w ( ‘#input1’ ). value is a string !

Just make it like this :


let tax=15;

$w.onReady(function(){
console.log("Page ready!");
    $w('#input1').onChange((){
    let resValue= Number($w('#input1').value) + tax + " $" 
    $w('#textFieldIDhere').text=resValue;
    });
});

@edouard
Well there was something that i forgot :sweat_smile:

Now it’s :arrow_right:ME​:arrow_left: , who should do this …

Perhaps you should consider to learn some JS-Basics, first.

W3Schools can help! → https://www.w3schools.com/ :rofl: