Mutually exclusive radio buttons
Radio buttons already group together using the name attribute. I suggest throwing away the code.



&lt;input type="radio" name="group1" value="male"&gt;Male&lt;br&gt;
&lt;input type="radio" name="group1" value="female"&gt;Female&lt;br&gt;&lt;br&gt;

&lt;input type="radio" name="group2" value="1"&gt;Active&lt;br&gt;
&lt;input type="radio" name="group2" value="0"&gt;Inactive