JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">google.load("jquery", "1")</script>
<body>
<h3 class="onlineCTA">Order Online</h3>
<form method="post" action="http://secure.ultracart.com/cgi-bin/UCEditor">
<input type="hidden" name="merchantId" value="BDH" />
<input type="hidden" name="add" value="chopblocCountertop" />
<table class="uc-item-table">
<tr class="uc-item-qty-row">
<td class="uc-item-qty-label" style="display: hidden;">Qty</td>
<td class="uc-item-qty-field">
<input type="text" name="quantity" value="1" />
</td>
</tr>
<tr class="uc-item-option-row-1">
<td valign="top">Coutnertop Thickness</td>
<td valign="top">
<input type="hidden" name="OptionName1" value="Countertop Thickness" />
<input type="radio" name="OptionValue1" value="0" />
1 inch
<br />
<input type="radio" name="OptionValue1" value="10" />
2 inch +10
<br />
<input type="radio" name="OptionValue1" value="15" />
3 inch +15
<br />
</td>
</tr>
<tr class="uc-item-option-row-2">
<td valign="top">Wood Type & Grain Style</td>
<td valign="top">
<input type="hidden" name="OptionName2" value="CBWoodType&Grain" />
<input type="radio" name="OptionValue2" value="300" />
Mahogany Edge Grain
<br />
<input type="radio" name="OptionValue2" value="300" />
Mahogany End Grain
<br />
<input type="radio" name="OptionValue2" value="300" />
Walnut Edge Grain
<br />
<input type="radio" name="OptionValue2" value="300" />
Walnut End Grain
<br />
<input type="radio" name="OptionValue2" value="300" />
Maple Edge Grain
<br />
<input type="radio" name="OptionValue2" value="300" />
Maple End Grain
<br />
<input type="radio"...
JavaScript
$(document).ready(function()
{
var total = 0;
function calcTotal()
{
$("input:checked").each(function()
{
//This happens for each checked input field
var value = $(this).attr("value");
total += parseInt(value);
});
}
//Page load data
calcTotal();
$(":submit").before('<p class="total">Cost: <strong>' + total + '</strong></p>');
$("input:radio").click(function()
{
total = 0;
calcTotal();
$("p.total").html("Cost: <strong>" + total + "</strong>");
});
});