title: Copy multiple input fields to other matching input fields with jQuery/Javascript
body: <p>I have a dummy form and the actual form in which at some point I want to copy all the input values from the dummy form across to the real form.
  The dummy fields will have the same names as the real form (so I can match them up).</p>
  
  <p>So in dummy form:</p>
  
  <pre><code>&lt;input name="item1" value="field1" /&gt;
  &lt;input name="item2" value="field1" /&gt;
  &lt;input name="item3" value="field1" /&gt;
  </code></pre>
  
  <p>and in real form:</p>
  
  <pre><code>&lt;input name="item1" value="" /&gt;
  &lt;input name="item2" value="" /&gt;
  &lt;input name="item3" value="" /&gt;
  </code></pre>
  
  <p>I assume I'll need to iterate over each input in dummy form (using jQuery .each() ?) while collecting the name and value in an JS object.
  Then iterate over each input in the real form, matching the name as the selector and setting the value (perhaps this can be done in the one .each() function ???)</p>
  
  <p>I've started with the following code which only grabs the values (and index) into an array, but because I need two values (name and value, and index is irrelevant) I assume I'll need an object not an array, but really not sure where to begin with that. </p>
  
  <pre><code>var inputValues = [];
      $("#dummyForm input").each(function() {
          inputValues.push($(this).val());
      });
  </code></pre>
  
  <p>Any help or advice much appreciated.</p>