# Code Help: Input, multiply and show result



**URL:** <https://forum.wixstudio.com/t/code-help-input-multiply-and-show-result/25765>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [April 21, 2020, 2:42pm UTC](https://forum.wixstudio.com/t/code-help-input-multiply-and-show-result/25765 "2020-04-21T14:42:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon46286](https://avatars.discourse-cdn.com/v4/letter/j/f04885/32.png) [@jon46286](https://forum.wixstudio.com/u/jon46286)\
**Post date:** [April 21, 2020, 2:42pm UTC](https://forum.wixstudio.com/t/code-help-input-multiply-and-show-result/25765/1 "2020-04-21T14:42:55Z")

</div>

Hey,

I need some help, I am trying to make this code work below. I am trying to enter details into each of the 4 boxes, the result of input 1 and 2 would then be added to the result of input 3 and 4, then displayed as “total”

Input 1 \* (Input 2 \*Number) + Input 3 \* (Input 4 \*Number)

```javascript
// For full API documentation, including code examples, visit https://wix.to/94BuAAs
$w.onReady(() => {
 let price1 = 0;
 let price2 = 0;
 let price3 = 0;
 let price4 = 0;
    $w("#input1, #input2, #input3, #input4").onChange(event => {
 let target = event.target.id;
 let newVal = Number($w("#" + target).value);
        target === "input1" ? price1 = 1 * newVal : price2 = 1 * newVal : price3 = 1 * newVal : price4 = 1 * newVal;
        $w("#total").text = (price1 + price2 + price3 + price4).toLocaleString();
    })
})

```

 ![](https://us1.discourse-cdn.com/wix/original/3X/2/1/2137a4b7404c63da189adf8e34cd93b54de4e6d5.jpeg)
