-1
保存在借条,如果我警惕的销售发票金额alert("sales" + si);
然后它说: -TR TD jQuery的每个先前的TD值不变量
不确定
这是为什么?
为什么它不能在si
保存价值?
任何帮助?
我的代码
$('input[type=button]').click(function() {
var trid = $(this).closest('tr').attr('id'); // table row ID
var grossProfit = 0;
$("tr#"+trid).each(function(i) { // row.
$("td", this).each(function(j) { // col.
console.log("".concat("row: ", i, ", col: ", j, ", value: ", $(this).text()));
//Sales Invoice.
if (j == 2) {
var si = $(this).find("input").val();
// if sales invoice not found/undefined.
if (typeof si === "undefined") {
si = 0; // if sales invoice is not defined.
}
alert("sales" + si);
}
// Debit Note.
if (j == 3) {
var dn = $(this).find("input").val(); // Debit note input value.
//if debit note not found/undefined.
if (typeof dn === "undefined") {
dn = 0; // if Debit Note is not defined.
}
alert("sales" + si);
}
});
});
});
单一的HTML行输入字段TR和TD 共享代码的HTML https://codeshare.io/21q4zj
添加html标记以及 – guradio
也请添加HTML –
所有tds的HTML行https://codeshare.io/21q4zj – Peter