title: assigning an array value to a hidden field in jquery
body: <p>Sure I'm missing something simple here.  I'm trying to assign a value to a hidden field via jquery.  It keeps returning nothing and I've tried several things.  I have an array on a form called personemail[] and it ids and names the fields accordingly, personemail[0], personemail[1] ect and I want to extract the first email address listed and assign it to a hidden field named person_email.</p>
  
  <pre><code>    &lt;script type="text/javascript" charset="utf-8"&gt;
      jQuery(document).ready(function() {
      var emailvalue = jQuery('#personemail[0]').val();
      jQuery('#person_email').val(emailvalue);
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm new to jquery so this is a bit of a mystery as to what I'm missing.  do I need to be using a .change() on the #emailperson[]?  I'm assuming I need to break into the array to grab the value but I'm unsure how.  I just can't get this piece to work.</p>
  
  <p>Here is the post data</p>
  
  <pre><code>Array ( [person_name] =&gt; max 
          [person_email] =&gt; 
          [person_phone] =&gt; 111-1111 
          [booking_seats] =&gt; 1 
          [personname] =&gt; Array ( [0] =&gt; max ) 
          [personemail] =&gt; Array ( [0] =&gt; max@max.com ) 
          [booking_comment] =&gt; 
          [eventAction] =&gt; add_booking 
          [event_id] =&gt; 14 )
  </code></pre>
  
  <p>As you can see I get the email address into the array just fine, I just can't get it to stick to person_email</p>
  
  <p>Here is a paired down version of HTML asked for, server side language is php.  The inputs are generated via a jquery clone function I've written.  Spits out a html element for each new person based on dropdown for the number of people selected:</p>
  
  <pre><code>&lt;form id='rsvp-form' name='booking-form' method='post' action='&lt;?php echo $destination ?&gt;'&gt;          
      &lt;tr class="personrow"&gt;
      &lt;th scope="row"&gt;&lt;/th&gt;&lt;td&gt;Name:&lt;br&gt;&lt;input class="required person" type="text" name="personname[0]" /&gt;&lt;br&gt;Email:&lt;br&gt;&lt;input class="required email additional" type="text" name="personemail[0]" id="personemail[0]" /&gt;&lt;/td&gt;&lt;td class="theextra"&gt;&lt;/td&gt;
  &lt;/tr&gt;       
  &lt;input type='hidden' name='person_email' id='person_email' /&gt;
  &lt;input type='submit' class='blkBTN' value='&lt;?php _e('Book It!', 'dbem') ?&gt;'/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &lt;input type='hidden' name='eventAction' value='add_booking'/&gt;
  &lt;input type='hidden' name='event_id' value='&lt;?php echo $EM_Event-&gt;id; ?&gt;'/&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks</p>