<div class="form-group">
<label for="code" class="col-sm-3 col-xs-3 text-right">工作量:</label>
<div class="col-sm-9 col-xs-9">
<input type="number" class="form-control" id="workload" name="workload" min="0" step="0.1">
</div>
</div>
<div class="form-group">
<label for="code" class="col-sm-3 col-xs-3 text-right">小计:</label>
<div class="col-sm-9 col-xs-9">
<input type="text" class="form-control" id="total" name="total" readonly>
</div>
</div>
//js代码
$("#unitPrice, #workload").on('input',function(){
var unitPrice = $('#unitPrice').val();
var workload = $('#workload').val();
var total = unitPrice*workload;
$("#total").val(total.toFixed(2));
})
js实时计算
最新推荐文章于 2022-08-02 16:19:00 发布