title: How can I get the value of a fieldset legend and pass that value into a hidden field
body: <p>I need a way to add a hidden field in a fieldset that holds the value of that fieldset's legend.</p>
  
  <p>I'm able to get the input field added after each fieldset legend, but I can't get the value of the fieldset passed into the value of the hidden field.</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var theLegend = $('legend');  
      $('&lt;input type="hidden"name="hiddenList[]" value="' + theLegend.val() + '"&gt;').insertAfter('legend');
  &lt;/script&gt;
  </code></pre>
  
  <p>Overall what I'm trying to achieve is get the value of the fieldset legend to pass into the database.  I need the hidden fields to be within their respective fieldsets.  The forms are being built with a form builder within a CMS, and I cannot "hack" the code for the form builder, so I need a way to do this with jquery/javascript, and I'm pretty much a jquery newbie...</p>