0
單選按鈕都將被添加並顯示在div數值:sub-total-t
爲什麼這不會輸出我的選擇?
JS
$(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));
});
});
HTML
<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>
這是爲什麼不顯示我的價值?
究竟不起作用?您的代碼適用於我http://jsfiddle.net/9prqY/ – undefined
它不顯示單擊單選按鈕的值。例如它應該顯示我點擊的任何值,並添加單選按鈕。它什麼也沒做。檢查錯誤螢火蟲和沒有看到任何 – fyz
正常工作:http://jsfiddle.net/Pndh4/除非你想顯示''的25' – Virendra