title: Radio button saving value of fist clicked, not changing to value of second/last clicked
body: <p>I am working on some legacy code. There is a set of radio buttons, true and false. True comes pre-selected. When I click false, then go back to click true the value being saved is false. How do I re-write this code to make it pull in the value of the LAST clicked radio button?</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;label class="input-radio"&gt;
     &lt;input name="radio" value="true" type="radio" checked  /&gt;
        &lt;span&gt;True&lt;/span&gt;
  &lt;/label&gt;
  &lt;label class="input-radio"&gt;
     &lt;input name="radio" value="false" type="radio" /&gt;
       &lt;span&gt;False&lt;/span&gt;
  &lt;/label&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>$('input[name="radio"]').change(function(){
   var selectedValue = $('input[name="radio"]:checked').val();
   if($(this).prop('checked')) {
     $('input[name="radio"]').prop('value',selectedValue);
  }
  });
  </code></pre>