I need an event trigger for a radio button for when it is unchecked because another button is checked
<p>I need an event trigger for a radio button for when it is unchecked because another button is checked.</p>

<p>The code below should demonstrate my dilemma.</p>

<p>If you will notice, there is an onchange event trigger atttached to each radio button and checkbox in the html code. In theory a change in state from checked to unchecked should fire the onchange event.</p>

<p>This happens as expected with the check boxes. If you check one, you get the alert, 'Your item is changed to checked'. If you uncheck it, you get the alert, 'Your item is changed to unchecked'.</p>

<p>With the radio buttons, when you check button one, you get, as expected, the alert, 'Your item is changed to checked' since the button changed from unchecked to checked. However, when you check the second button and the first radio button is changed from checked to unchecked the "onchange" event trigger does not fire and the 'else' alert is not triggered.</p>

<p>So this issue for me is what event is triggered when a radio button gets unchecked by another button being checked?</p>

<p>I appreciate everyone's assistance on this.</p>

<p>--Kenoli    </p>

<pre><code>    &lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;

&lt;script type="text/javascript"&gt;

function clickAction() {

    //alert ('Your item changed');

    if (this.checked == true) {alert ('Your item is changed to checked');}

    else if (this.checked == false) {alert('Your item is changed to unchecked');}

}



&lt;/script&gt;

&lt;script type="text/javascript"&gt;

function initializeToggles() {

    var button1= document.getElementById('button1');
    button1.onchange = clickAction;

    var box1= document.getElementById('box1');
    box1.onchange = clickAction;

    var box2= document.getElementById('box2');
    box2.onchange = clickAction;

}

&lt;/script&gt;

&lt;script type="text/javascript"&gt;window.onload = initializeToggles;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;input type="radio" name="testRadio" id="button1" &gt;Button one&lt;br/&gt;
&lt;input type="radio" name="testRadio" id="button2" &gt;Button two&lt;br/&gt;&lt;br/&gt;

&lt;input type="checkbox" name="testCheckbox" id="box1" &gt;Box one&lt;br/&gt;
&lt;input type="checkbox" name="testCheckbox" id="box2" &gt;Box two&lt;br/&gt;&lt;br/&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
