Radio Button Class Changes

Radio Button Class Changes

Hello,
I am trying to use a radio button click event to change the class of non parent fields.
say a radio button group like
<ul>   
  <li><input type="radio" value="1" /> 1</li>
  <li><input type="radio" value="2" />2</li>
  <li><input type="radio" value="3" />3</li>
</ul>
 

When I click on 1, I want all tags with a class of 1 to have a class added, and all tags with a class of 2 and 3 to have a class removed, and when 2 is clicked, the class is removed from 1 and 3, and a class added to all tags with a class of 2, the same with three.

How should I do this function?