U
U
Ulan Murzaliev2020-04-20 09:21:41
JavaScript
Ulan Murzaliev, 2020-04-20 09:21:41

How to add the values ​​of two inputs and an array?

Good afternoon! codepen.io/tu03422/pen/WNQGrxp?editors=10 there is such an option for calculating the cost (I am studying js), the user specifies the dimensions and selects the type of product. I learned to display the cost without choosing a product option, that is, if there is no choice of a picture, but if the user needs to choose, then I’m not catching up with how to add up, and am I right in thinking that if the issue is resolved with the pictures, then it will be possible to add up in the same way values ​​from selecta to total?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-04-20
@hzzzzl

you can make one event handler "recalculate the amount", and hang it on EVERYTHING, on changes in the input range, select, and this "partition type"
that is, when the user clicks on something, the same function is launched that hooks the values ​​​​of the elements at the moment, and recalculates the amount
for the active "partition type", for example, you can hang up the .selected class to make it easier to get to the selected type, and instead of data-name, immediately enter data-price in the pictures

add the values ​​of two inputs and an array

I don't understand what array you are talking about :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question