I'm doing a form where the user has a list of options. Some radio buttons, some checkboxes. The user is probably wishy-washy and will change their minds. I need to change the checked value in the input and also the class, so I can target those values through form submission. This needs to happen till the user clicks Submit. Here's what I have so far, which changes the "checked" attribute and class, but once the button is no longer selected, they don't change back. Help!
$("input:checkbox, input:radio").change(function() {
if ($("input:checked")) {
    $(this).attr("checked",true);
    $(this).addClass("checked");
} else {
    $(this).attr("checked",false);
    $(this).removeClass("checked");
}
});
UPDATE: Still nothing. I've pared it down to what's below and it still doesn't remove the class on change.
    $("input:checkbox, input:radio").change(function ()
   {
       if (this.checked)
      {
         $(this).addClass("checked");
      }
      else
       {
         $(this).removeClass("checked");
       }
   });
 
     
     
     
    