如何从名称为 name="TotalInline[]"
的所有输入中添加值?
以下内容不起作用:
var total = 0;
$.each('input[name="TotalInline[]"];,function() {
total += this;
});
最佳答案
这应该有效:
var total = 0;
$('input[name="TotalInline"]').each(function() {
// assuming you have ints in your inputs, use parseFloat if those are floats
total += parseInt(this.value, 10);
});
关于javascript - 添加输入名称为 ="TotalInline[]"的所有值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12375661/