I am still learning JavaScript and need a hand to update my script to count several elements in my form. I use this script in my form to capture the value of a switch and add this value to the Sum field in the event verification form.
$(function(){
$('.ticketAmount').click(function() {
$('#Amount').val(this.value);
});
});
Now I have a new form that has several options for choosing tickets. Now the client selects a ticket and has several flags to add a private tour and an assortment of goods.
Here is my HTML code:
<div>
<input type="radio" name="da" value="150" class="ticketAmount" />
<strong>Regular Ticket $150.00</strong>
</div>
<div>
<input type="radio" name="da" value="250" class="ticketAmount" />
<strong>Couples Ticket $250.00</strong>
</div>
<div>
<input type="radio" name="da" value="1500" class="ticketAmount" />
<strong>Table (Seats 10 Individuals) 1500.00</strong>
</div>
<div>
<input type="checkbox" name="da" value="50" class="ticketAddition" >
<strong>Private Tour $50.00</strong>
</div>
<div>
<input type="checkbox" name="da" value="25" class="ticketAddition" >
<strong>Meet the Chef $25.00</strong>
</div>
I want the checkboxes below to display their values in total when they are checked. Any help would be greatly appreciated.
source
share