0
我想添加commision,如果特殊commision有任何值,否則我想設置commision爲2 %%默認情況下,如果用戶離開該字段空白,當我沒有把任何價值的計算是正確的,但是當我把任何值說100,那麼值concordinated到commision而不是另外請告訴我什麼是我的代碼中的錯誤?jquery添加,而不是conacatination
這裏是我的功能:
$('body').delegate('.quantity,.price,.discount,.spl', 'keyup', function() {
var tr = $(this).parent().parent();
var qty = tr.find('.quantity').val();
var price = tr.find('.price').val();
var special_commision = 2/100;
if($('.spl').val()){
var special_commision = parseInt($('.spl').val()) + special_commision ;
}
var dis = tr.find('.discount').val();
var amt = (qty * price) - (qty * price * dis)/100;
cal_spl = amt*special_commision;
tr.find('.amount').val(amt);
tr.find('.sm').val(cal_spl);
total();
});