You will see the sample code.
Below are my problems: -I have to select the services which has a value, but when I cancel the services the total price increase instead of decrease. -After I tested it, I cancel all the services, but the total price is still there. How can I get it back to zero?
Thank you! :)
Here's my sample code:
$(".chzn-select").chosen();
$("#cboservices").on("change", function(evt, params){
alert($(this).val());
//console.log($(this).val());
parray = $(this).val();
for (pcode in parray) {
get_priceList(parray[pcode]);
//console.log(sprice * totaltime);
tprice = tprice + (sprice * totaltime);
}
$("#subTotalPrice").html(number_format(tprice, 2, ".", ""));
console.log($("#subTotalPrice").html());
});
}
},
Below are the sample HTML. I can't paste the whole code because it has limit. Thank you for the quick reply.
reservationDetails =
'<div id="modal_div" class="widgets">'+
' <div class="widget widgetFix">'+
' <div class="title"><img src="images/icons/color/user-silhouette-question.png" alt="" class="titleIcon" /><h6>Information</h6></div>'+
' <br />'+
' <div id="refdiv" class="formRow modalFix">'+
' <label>Reference No:</label>'+
' <div class="formRight"><label class="labelFix inputFix" id="refNoValue">0</label></div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="formRow modalFix">'+
' <label>Room No:</label>'+
' <div class="formRight"><label class="labelFix inputFix" id="roomNoValue">0</label></div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="formRow modalFix">'+
' <label>Name:</label>'+
' <div class="formRight"><input type="text" id="customerNameValue" name="customerNameValue"/></div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="formRow modalFix">'+
' <label>Services:</label>'+
' <div class="formRight labelFix">'+
' <select id="cboservices" data-placeholder="Choose your service(s)..." class="chzn-select" multiple="multiple" tabindex="6">'+
' </select>'+
' </div>'+
' </div>'+
' <div class="formRow modalFix">'+
' <label>Price:</label>'+
' <div class="formRight"><label class="labelFix inputFix" id="subTotalPrice">0.00</label></div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="clear"></div>'+
' <div class="formRow modalFix">'+
' <label>Personnel:</label>'+
' <div class="formRight labelFix">'+
' <select id="cbopersonnels" data-placeholder="Choose your attendant(s)..." class="chzn-select" multiple="multiple" tabindex="6">'+
' </select>'+
' </div>'+
' </div>'+
' <div class="clear"></div>'+
' <div class="formRow modalFix">'+
' <label>Date:</label>'+
' <div class="formRight"><label class="labelFix inputFix" id="dateValue">0</label></div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="formRow modalFix">'+
' <label>Start Time:</label>'+
' <div class="formRight"><label class="labelFix inputFix" id="startTimeValue">0</label></div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="formRow modalFix">'+
' <label>End Time:</label>'+
' <div class="formRight"><label class="labelFix inputFix" id="endTimeValue">0</label></div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="formRow modalFix">'+
' <label>Status</label>'+
' <div class="formRight ">'+
' <select id="statusValue" name="statusValue">'+
' <option value="reserved">Reserved</option>'+
' <option value="paid">Paid</option>'+
' </select>'+
' </div>'+
' <div class="clear"></div>'+
' </div>'+
' <div class="formRow modalFix" style="margin-top:3px">'+
' <label>Remarks</label>'+
' <div id="remarksdiv" class="formRight ">'+
' <textarea id="remarksValue" name="remarksValue" style="resize:none;"></textarea>'+
' </div>'+
' <div class="clear"></div>'+
' </div>'+
' <br />'+
' </div>'+
' <div class="clear"></div>'+
'</div>';