这是我的问题。我正在尝试将输入值保存在2个不同的变量中,然后将总和我得到一个错误:
var stcost = $("#item_cost").val(); //is 1.200
var val2=(actval*stcost/100).toFixed(3); //is 1.200
console.log("val2 first value: "+val2); //val2 first value: 0.014
var val2=(val2 + stcost).toFixed(3); //ERROR: custom.js:225 Uncaught TypeError: (val2 + stcost).toFixed is not a function
//at Object.myCallbackFunction [as onUpdate] (custom.js:225)
//at _update (dataTables.cellEdit.js:68)
// at jQuery.fn.init.updateEditableCell (dataTables.cellEdit.js:54)
//at HTMLInputElement.onfocusout (index.php?r=aXRlbW1udGM:1)
console.log("cost: "+stcost);
console.log("val2: "+val2);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
这段代码出了什么问题?