Hi this is the situation
var seat_sel = document.getElementById('cmb_num_seat').value;
var cashp = document.getElementById('hdn_price').value;
var CHILD_PRICE = '5'
if(seat_sel > 0){
CHILD_PRICE = CHILD_SEAT_PRICE * seat_selected;
}else{
CHILD_PRICE = CHILD_SEAT_PRICE * seat_selected;
}
document.getElementById('disp_2_div').innerHTML = formatCurrency(parseInt(cashp)+parseInt(CHILD_PRICE));
document.getElementById('hdn_price').value = formatCurrency(parseInt(cashp)+parseInt(CHILD_PRICE))
For example...
i have cashp=20 ,
When user select the cmb_num_seat(DROP DOWN) , Then Price will be increase That is
20+(5*3)=20+15=45
Assume i selected 3 in the dropdown...
But in some situation , Calculation goes wrong...
Like select 3 , and then select 4 and then select 2 and then selecting 1 ,
In this situation old value hdn_price is over riding ...bcoz of ADDITION ...
Is there any way ...maintain first value in some variable and then doing the calculation...