我面临一个覆盖输入框的表格单元格值的问题, 我想根据上一个单元格进行一些计算, 但也想在用户通过输入文本输入时覆盖
如果我同时执行两个操作,则自动计算已完成,但输入的值消失了
var otherAllowanceX;
var otherAllowance = tr.find($('input[name="other_allowance[]"]')).val() || otherAllowanceX;
if(otherAllowance ==''){
if (parseFloat(basicPay) >= 5500 )
{
//var pTax = 300;
otherAllowanceX = parseFloat((parseFloat(1624.02)/CURR_MONTH_DAYS)*noOfDays);
tr.find('input[name="other_allowance[]"]').val(otherAllowanceX);
}
else
{
// var Allowance = 245.67;
otherAllowanceX = parseFloat((parseFloat(245.67)/CURR_MONTH_DAYS)*noOfDays);
tr.find('input[name="other_allowance[]"]').val(otherAllowanceX);
}
}
console.log(":::: Other AllowanceX "+otherAllowanceX+" :::: Other Allowance"+otherAllowance);
表格字段
<td><input type="text" class="cal form-control" name="other_allowance[]" placeholder="Other Allowance" value="0"></td>
我要使输入框可编辑,并在输入值时跳过计算