【发布时间】:2013-04-12 04:37:52
【问题描述】:
我怎样才能(通过每个函数)自动对字段求和以对一些输入字段求和:
<input name="price_1" id="price_1" type="text" value="50" />
<input name="price_2" id="price_2" type="text" value="40" />
<input name="price_3" id="price_3" type="text" value="20" />
<input name="price_4" id="price_4" type="text" value="10" />
<input name="price_5" id="price_5" type="text" value="80" />
如果有人有建议,非常感谢?
【问题讨论】:
-
选择输入...获取值...添加它们。有什么问题?
-
好吧,我写得不够清楚。我每行有多个输入字段,这就是为什么我需要从特定输入字段中捕获值的原因。对于这个例子,它是 id="price_[]"。
标签: javascript sum each