JSFiddle - React, Tailwind, and code Playground
HTML
<div id="pinForm">
Signal Direction:<br/>
<div id="pinio">
<input type="radio"
name="I_O"
value="0"
> In<br />
<input type="radio"
name="I_O"
value="1"
> Out<br />
</div>
Change Radio Button <br/>
<input type="button"
value="Swap"
onclick="setPinDir()"
>
</div>
JavaScript
//Start with Chrome browser
//Use Jquery 1.3.2 or 1.4.4 or 1.5.2
//Run the program
//Press the SWAP button multipe times, each swap alterntates which radio button is checked
//Use Jquery 1.6
//Run the program
//Press the SWAP button multiple times, the buttons swap once and then never again.
//Do the above with IE 8 and Firefox 4.01. IE 8 seems to work with 1.6 Firefox 4.01 fails with 1.6
var pinDir=0;
function setPinDir()
{
$('input:radio[name=I_O]').filter('[value='+pinDir+']').attr('checked', true);
if(pinDir == "0")
{
pinDir = "1";
}
else
{
pinDir = "0";
}
}