简体   繁体   English

获取多个输入值 Onchange Action - JQUERY

[英]Get multiple inputs value Onchange Action - JQUERY

How can we get multiple inputs value "onchange" action?我们如何获得多个输入值“onchange”动作? I need to calculate it and diplay results on another input at the same form..我需要计算它并以相同的形式在另一个输入上显示结果..

here is my Code:这是我的代码:

<f:input id="note1" path="infoformation.note1" />
<f:input id="note2" path="infoformation.note2" />

// where I should return results after sum the two values.. // 在对两个值求和后我应该返回结果的地方..

<f:input id="notetotal" path="infoformation.noteTotal" />

Try,尝试,

Html html

<input type="text" id="firstInputId" />
<input type="text" id="secondInputId" />

Script脚本

$(document).ready(function(){
 $("input[type=text]").change(function(){
  $("#secondInputId").val($("#secondInputId").val()+","+$(this).val());
 });
});

Fiddle小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM