Good all the time. Faced such a problem. Made a calculator. When choosing / calculating, the amount is shown below in the process of calculations. It is necessary that the amount does not appear immediately and when you click the "Calculate" button.

Here is how it looks in the body of the site:

<div class="calc-result"> <span class="str" data-edit="" contenteditable="true">Итого сумма заказа: <span class="green"><span id="CalculatorResult">0</span> руб.</span> </span> <button class="button-yellow"><span>Рассчитать</span> </button> <button class="button-yellow" data-modal="Modal-order"><span>Заказать</span> </button> </div> 

As you can see, the line below displays the resulting amount:

 <span class="str" data-edit="" contenteditable="true">Итого сумма заказа: <span class="green"><span id="CalculatorResult">0</span> руб.</span> 

Help me to understand.

  • Need to watch script code - Andrew Hobbit
  • remove 0 from <span id="CalculatorResult">0</span> and will not output - Grundy
  • If the "0" to remove - will display. When you click on any of the lists. - Roman
  • I can throw the script, but I think this footwoman will not help here. As I understand it, you need to hide the line displaying the amount before pressing the "calculation" button. - Roman
  • If you want it not to be calculated before pressing the button, then you need to hide the element by default. Attach an event to the "calculate" button: 1) calculate it 2) show the button - Pleshevskiy

1 answer 1

Solved the problem. If someone in the future will need:

 <div class="calc-result"> <span class="str" data-edit="" contenteditable="true" style="display: none;" id="pr">Итого сумма заказа: <span class="green"><span id="CalculatorResult">0</span> руб.</span> <button class="button-yellow" data-modal="Modal-order"><span>Заказать</span> </button> </span> <button class="button-yellow" onclick="document.getElementById('pr').style.display='block'; return false;"><span>Рассчитать</span> </button> </div> 

Works. It remains only to align the button "calculation". Crawled down.