title: Using jQuery to select/deselect radio buttons with different names
body: <p>I have a Quiz that uses ids of the answers in the DB as the name in order to check if they're correct.  So basically I can't make them all the same name.</p>
  
  <p>Anyways this leaves me with radio buttons that can be all checked and that isn't how it should work.  I found jQuery that allows for the radio buttons to be unchecked but I need them to uncheck when you click other buttons.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;fieldset&gt;
      &lt;input type="radio" name="21"&gt;
      &lt;label for="21"&gt;Answer 21&lt;/label&gt;
      &lt;input type="radio" name="22" class="checked"&gt;
      &lt;label for="22"&gt;Answer 22&lt;/label&gt;
      &lt;input type="radio" name="23" class=""&gt;
      &lt;label for="23"&gt;Answer 23&lt;/label&gt;
      &lt;input type="radio" name="24"&gt;
      &lt;label for="24"&gt;Answer 24&lt;/label&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>    $("input[type='radio']").click(function (event) {
      // If the button is selected.
      if ($(this).hasClass("checked")) {
          // Remove the placeholder.
          $(this).removeClass("checked");
          // And remove the selection.
          $(this).removeAttr("checked");
          // If the button is not selected.
      } else {
          // Remove the placeholder from the other buttons.
          $("input[type='radio']").each(function () {
              $(this).removeClass("checked");
          });
          // And add the placeholder to the button.
          $(this).addClass("checked");
      }
  });
  </code></pre>
  
  <p>So if 21 is checked and I click 22, 21 should uncheck</p>