Add class and remove class based on checked radio? [duplicate]
问题 This question already has answers here : Add class to target based on radio input value (toggle, like function) (2 answers) Closed 6 years ago . Here is my jsbin, http://jsbin.com/ugufi/11 I removed any attempt I made to remove the class, because it just kept alerting undefined. My problem is when I add the checked class to my target I (as said above) fail to remove the class of the target. I cannot use parent or sibling selectors, because the target is separate from my nested radio inputs.