单选按钮具有数字值,这些数值将添加并显示在div中:sub-total-t
$(document).ready(function() {
$('label').click(function() {
var total = 0;
$('.option:checked').each(function() {
total += parseFloat($(this).data('number'))
});
$('.sub-total-t').html('$' + total.toFixed(2));
});
});
<label><input type="radio" name="print" class="option" data-number="25" value="p10"/> Starter 500 </label>
<div id="sub-pricing">
<h3> Sub-Total </h3>
<div class="sub-total-t">$</div>
</div>
为什么这不显示我的价值?