【问题标题】:How to copy data from one form to another?如何将数据从一种形式复制到另一种形式?
【发布时间】:2014-07-29 10:29:10
【问题描述】:

我有表格:

<form action="" method="post" id="form1">
    [many inputs, selects etc - form is used to filter the displayed results]
</form>

[content]
<table ...>
  <tr>
     <td>...<td>
     <td>
       <form action="" method="post" id="form2">
         [some inputs on row]
         <input type="submit" name="updaterow" value="Update row" />
       </form>
     </td>
  </tr>
</table>

当我点击form2上的提交按钮时,我想将输入数据从form1复制到form2。怎么做?

【问题讨论】:

  • 你是如何匹配输入的?
  • 输入名称具有唯一名称
  • 两种形式的元素是否同名?
  • 否 - 每个表单元素在所有 html 正文上都有唯一的名称

标签: jquery forms


【解决方案1】:

如果两种形式的元素名称相同,那么您可以使用this 像这样的插件:-

$("#form2").values($("#form1").values()); 

如果不是那么--
这里正在工作FIDDLE

【讨论】:

    猜你喜欢
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-06
    相关资源
    最近更新 更多