title: Set hidden input value depending on radio button selection
body: <p>I have a checklist form that tallies a score based on the radio button selection that is working fine. When I post the form I want to get a value of "yes" or "no" from a hidden input with the same class based on radio button selection.</p>
  
  <p>Because the "value" field is taken up by an integer for the scoring I want to pass a value to a hidden form input with the same class name. The value of the hidden input will be "no" if the value of the radio button selected is 0, or else it will be "yes". </p>
  
  <p>I would like to be able to iterate it through all radio input groups (there are many). This is what I am trying to acheive in jquery written in English:</p>
  
  <p>FOR each radio input group, IF the value of radio button selected is 0 then value of hidden input with the same class is "No", ELSE it is "yes".</p>
  
  <p>I am having trouble with the javascript and would appreciate some assistance.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;!--Radio button example --&gt;
  &lt;li&gt;
      &lt;label&gt;Does 1 + 1 equal 10 ?&lt;/label&gt;
      &lt;input type="radio"  class="radio1" name="question" value="1"&gt;Yes&lt;/input&gt;
      &lt;input type="radio"  class="radio1" name="question" value="0"&gt;No&lt;/input&gt;
      &lt;input type="hidden" value="" id="answer" class="radio1"&gt;&lt;/input&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Thank you in advance, please let me know if you need more information.</p>