I’m making an online hotel booking form and ran into a problem: I’ve added a function to automatically calculate the cost depending on the client’s choice, it’s all displayed in the span tag, I’m not able to pull the final amount into the handler.
Counting Script:
<script type="text/javascript"> function calc() { var bookingInputRoom1 = document.getElementById("bookingInputRoom1"); var bookingInputRoom2 = document.getElementById("bookingInputRoom2"); var col1 = document.getElementById("col1"); var col2 = document.getElementById("col2"); var result = document.getElementById("result"); var price = 0; price += (col1.checked == true) ? parseInt(bookingInputRoom1) : 0; price += (col2.checked == true) ? parseInt(bookingInputRoom2) : 0; result.innerHTML = price; } </script> So I deduce the cost:
Стоимость бронирования: <span id="result" value="0" name="summa">0</span> руб How to display the amount correctly so that you can later send it to the handler? Thank you in advance!