问题描述
我想更改多个文本框值,那时结果应显示在位置上的结果文本框值上。
我在这个问题上用谷歌搜索,最能回答的是,从 change 事件可以正常运行,但是我仍然尝试 change 以及 on 事件没有为我工作。
这是我的查看代码
<nop-editor asp-for="Weight" />
<nop-editor asp-for="Quantity" />
<nop-editor asp-for="Fine" />
<nop-editor asp-for="Rate" />
<nop-editor asp-for="LabourCharge" />
<nop-editor asp-for="UnitPriceInclTax" />
这是我的jquery代码,
$("#LabourCharge,#LabourChargeUnit,#Rate").on('input',function () {
var fine = $('input[id="Fine"]').val();
var rate = $('input[id="Rate"]').val();
totalFineRate = fine * rate;
if (selectedLabourChargeUnitId == 1) {
var weight = $('input[id="Weight"]').val();
var labourCharge = $('input[id="LabourCharge"]').val();
var totalLabourCharge = weight * labourCharge;
}
if (selectedLabourChargeUnitId == 2) {
var pcs = $('input[id="Quantity"]').val();
var labourCharge = $('input[id="LabourCharge"]').val();
var totalLabourCharge = pcs * labourCharge;
}
totalPrice = totalLabourCharge + totalFineRate;
$('#UnitPriceInclTax').val(totalPrice);
});
现在按照代码,当我更改 totalLabourCharge 或 totalFineRate 时,相关值应显示 $('#UnitPriceInclTax')。val() ; 无效。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)