title: Selecting values of two radio buttons jQuery
body: <p>I have the following HTML:</p>
  
  <pre><code>&lt;div class="row1"&gt;
      &lt;input type="radio" name="group1" value="0" checked="checked"/&gt;Zero
      &lt;input type="radio" name="group1" value="1" /&gt;One
  &lt;/div&gt;
  
  &lt;div class="row2"&gt;
      &lt;input type="radio" name="group2" value="0" checked="checked" /&gt;Zero
      &lt;input type="radio" name="group2" value="1" /&gt;One
  &lt;/div&gt;
  </code></pre>
  
  <p>Along with the following jQuery code:</p>
  
  <pre><code>$(document).ready(function() {
      var val1 = "";
      var val2 = "";
  
      $('input[name="group1"],input[name="group2"]').change(function() {
          val1 = $('input[name="group1"]').val();
          val2 = $('input[name="group2"]').val();
          alert(val1 + " : " + val2);
      });
  
  });
  </code></pre>
  
  <p>Now, my expected result is that when one of the radio buttons is changed, it gets the selected values of both radio buttons and displays them in an alert box. </p>
  
  <p>As you can see using my jsFiddle here: <a href="http://jsfiddle.net/2whkp/" rel="nofollow">http://jsfiddle.net/2whkp/</a> The result is always 0:0. I have a feeling this may be due to it always just getting the first radio button by that name. If that is the case however, how would I work around this?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Dave</p>