I am a beginner and I have an if statement that is returning the input value in the text box that I want the calculation to be in, and returning the calculation in the text box where I originally input the information.
diagram of problem
$w.onReady(function () {
$w("#generatequote").onClick((event) => {
var SR = Number($w("#SR").value);
if (SR<100) {
$w("#SR").value = SR*2
//if the input number is less than 100 display the input number times two
}
$w("#quotetext").value =(SR)
});
This is a different way I tried but then it displays the input value without making the calculation
var SR = Number($w("#SR").value);
if (SR<100) {
$w("#SR").value = ("#SR")*2
This is another way I tried but it also doesn't make the calculation
var SR = Number($w("#SR").value);
if (SR<100) {
$w("#SR").value *2
}
Just a guess, the only problem with your first code seems to be that you mixed up the two text-boxes.
"#SR"
is the input box, and you are giving it a value of SR*2
.
$w("#SR").value = SR*2
While "#quotetext"
is where you want to display the result, but you are giving it a value of SR
.
$w("#quotetext").value =(SR)
So, try flipping it around?
$w.onReady(function () {
$w("#generatequote").onClick((event) => {
var SR = Number($w("#SR").value);
if (SR<100) {
$w("#quotetext").value = SR*2
//if the input number is less than 100 display the input number times two
}
$w("#SR").value =(SR)
});