# :checked hell

**URL:** <https://forum.kirupa.com/t/checked-hell/329500>\
**Category:** web dev\
**Created:** [September 6, 2012, 3:51pm UTC](https://forum.kirupa.com/t/checked-hell/329500 "2012-09-06T15:51:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denise032](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@Denise032](https://forum.kirupa.com/u/Denise032)\
**Post date:** [September 6, 2012, 3:51pm UTC](https://forum.kirupa.com/t/checked-hell/329500/1 "2012-09-06T15:51:53Z")

</div>

I’m trying to add a class to a dropdown field on a form based upon which radio button the person selects. Right now the :checked function is only working if the radio button is checked when the page loads. If you select the other radio, the class won’t clear. Here is a link and code:

[http://bca.fsa.sunysb.edu/cancel2.php](http://bca.fsa.sunysb.edu/cancel2.php)

**HTML** :

```auto

...
<td><label for="action"><strong>Select an Action*</strong></label></td>

<td><input name="action" type="radio" onclick="disableDowngrade(this.checked)" value="Cancel" id="Cancel" /> Cancel a Plan

<span class="h-space"><input name="action" type="radio" onclick="disableCancel(this.checked)" checked="CHECKED" value="Downgrade" id="Downgrade" /> Downgrade Existing Plan</span></td>
</tr>

<tr>
<td><label for="down_amt"><strong>Amount of Downgrade (per Semester)*</strong></label></td>

<td><select name="down_amt" id="down_amt">

<option value="">Select Amount</option>

<option value="-$100">-$100.00</option>
...

```

**JQuery to add class** :

```auto

if($('#Downgrade').is(':checked')) {
  $("#down_amt").addClass("test");
} else if($('#Cancel').is(':checked')) {
  $("#down_amt").removeClass("test");
}

```
