简体   繁体   中英

How to copy data from one form to another?

I have forms:

<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>

And I want to copy data of inputs from form1 to form2 when I click submit button on form2. How to do it?

if both forms have same elements name then you can use this plugin like :-

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

if not then--
here is working FIDDLE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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