D
D
DeniSidorenko2017-07-23 17:30:16
JavaScript
DeniSidorenko, 2017-07-23 17:30:16

Logic for building a JavaScript script?

9ae7c64c92.jpg
Hello, please take a look at the screenshot. The point is that there are goods and attributes. That is, the color is red gray, etc. Also on the top left is the full price. As you can see when choosing a color, the text becomes bold. It is also written in brackets they say + how much will be for the product. I need that when I click on the attribute, the color changes as it is now, but there was no + 25 in brackets, for example, but already the full price, which js will subtract. That is, the regular price is 80, writes + 20 in brackets. I click on the color and it becomes bold and already + 100 in brackets. There are a lot of such goods and I get confused in cycles. I don't need you to write code. I'll just be very happy if you write the logic for all this. Just logic how to do it. thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kornilov, 2017-07-23
@DeniSidorenko

Not difficult.
By clicking on the desired color, call the textContent parameter of the element containing the price and assign the calculated value to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question