I am re-updating this post as i never really got an working answer and i have yet to figure one out. So i am doing a very basic calculation and it is working fine. However, i have a lingering issue to work out. In the code below i am restricting the result to 8 digits. But i need the math to look at the 9th digit and round the 8th digit up depending on if it is a 5 or higher. I think i need to use Math.round to do that, but i cant figure out where do i put that in my code. I have tried a dozen different places and methods but i always get an error saying either math is not defined, or unexpected token at the end closing }. Not sure how to do that is needed. Here is my code.
var price
var cost
var breakeven
$w.onReady( function () {
price = $w(“#price”);
cost = $w(“#cost”);
breakeven = $w(“#breakeven”);
});
export function submit_click(event) {
var var1 = price.value;
var var2 = cost.value;
breakeven.value = +var1 * 1.001 * 1.001 + .00000001
$w('#breakeven').value = parseFloat(String(breakeven.value)).toFixed(8);
}
I have the same type of math in an excel spreadsheet using the roundup function and it works correctly, just not when i try to replicate it in the wix code. Any help would be great as i have fighting with this for over a month now.