JSFiddle - React, Tailwind, and code Playground
HTML
<form id="order">
<div class="col">
<strong>Package</strong><br /><hr />
<input type="radio" name="pack" value="1049" />Pack 1<br />
<input type="radio" name="pack" value="1199" title="MVP Package"/>Pack 2<br />
<input type="radio" name="pack" value="1199" title="Oceanview" />Pack 3<br />
<input type="radio" name="pack" value="1299" />Pack 4<br />
<input type="radio" name="pack" value="1499" />Pack 5</div>
<div class="col">
<strong>Accomp</strong><br /><hr />
<input type="radio" name="accomp" value="129" />1<br />
<input type="radio" name="accomp" value="258" />2<br />
<input type="radio" name="accomp" value="1057" />3<br />
<input type="radio" name="accomp" value="1856" />4
</div>
</form>
<div class="clear"></div>
<hr id="bar" />
<div class="clear"></div>
<div>
<div class="col">
<strong>Total: </strong><span id="total">0</span>
</div>
<div class="col" style="width:200px">
<strong>Title: </strong><span id="title"></span>
</div>
</div>
CSS
.col {
float: left;
width:100px;
}
.clear {
clear:both;
}
#bar {
float:left;
width:200px;
}
JavaScript
$("form#order :input[type=radio]").each(function(){
$(this).bind('change', function() {
checkOptions();
});
});
var checkOptions = function () {
var total = 0;
var pack = parseInt($('input[name=pack]:checked', '#order').val());
var accomp = parseInt($('input[name=accomp]:checked', '#order').val());
if (!isNaN(pack)) total += pack;
if (!isNaN(accomp)) total += accomp;
$('#total').text(total);
$('#title').text($('input[name=pack]:checked', '#order').attr('title'));
};