我只想为选中的复选框删除禁用的属性
我的代码将其全部删除
演示http://jsfiddle.net/XqUH2/8/
$('input[type="number"]').change(function(){
var priceRow = $(this).parent().next();
priceRow.text('$'+Math.round($(this).val()*priceRow.attr('unit-price')*100)/100);
updateTotal();
});
$('.ad_promote_days').prop('disabled', true);
$('input[type="checkbox"]').change(function(){
if($("input[type=checkbox]:checked").length == 0){
$('.ad_promote_days').prop('disabled', true);
}else{
$('.ad_promote_days').prop('disabled', false);
}
updateTotal();
});
function updateTotal(){
var total = 0;
$('input[type="checkbox"]:checked').each(function(){
var priceRow = $(this).parents('tr').children('td[unit-price]');
total += parseFloat(priceRow.text().replace('$',''));
});
$('#ad_promote_total_cost').text('$'+total);
}
$('input[type="checkbox"]').change(function(){
if($(this).is(':checked')){
$(this).closest('tr').find('.ad_promote_days').prop('disabled', false);
}
else{
$(this).closest('tr').find('.ad_promote_days').prop('disabled', true);
}
updateTotal();
});
演示:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句