title: How to select only one checkbox from list of checkboxes with help of javascript
body: <p>I have html form with lots of checkboxes which are dynamically generated by PHP based on data in my mysql table. First 3 checkboxes (FBS, PPBS, RBS) are such that only one should be selected. if checkbox 1 is selected then 2 and 3 must be deselected, if 2 is selected then 1 and 3 must be deselected, if 3 is selected then 1 and 2 must be deselected. so essentially either none of the first 3 checkboxes should be selected or only one.</p>
  
  <p>i cant use radio button as these checkboxes are dynamically generated. if i use radio button then there will be issue with rest of the checkboxes.
  sample code is given below.</p>
  
  <pre><code>&lt;input type="checkbox" name="boxset[]" value="FBS" id="1"&gt;&amp;nbsp;FBS&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="PPBS (2 hrs)" id="2"&gt;&amp;nbsp;PPBS (2 hrs)&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="RBS" id="3"&gt;&amp;nbsp;RBS&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="SGOT" id="4"&gt;&amp;nbsp;SGOT&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="SGPT" id="5"&gt;&amp;nbsp;SGPT&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="ALP" id="6"&gt;&amp;nbsp;ALP&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="T. Protein" id="7"&gt;&amp;nbsp;T. Protein&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="S. Albumin" id="8"&gt;&amp;nbsp;S. Albumin&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="T. Bilirubin" id="9"&gt;&amp;nbsp;T. Bilirubin&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="D. Bilirubin" id="10"&gt;&amp;nbsp;D. Bilirubin&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Urea" id="11"&gt;&amp;nbsp;Urea&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Creatinine" id="12"&gt;&amp;nbsp;Creatinine&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Sodium (Na+)" id="13"&gt;&amp;nbsp;Sodium (Na+)&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Potassium (K+)" id="14"&gt;&amp;nbsp;Potassium (K+)&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Chloride (Cl-)" id="15"&gt;&amp;nbsp;Chloride (Cl-)&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Calcium" id="16"&gt;&amp;nbsp;Calcium&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Phosphorous" id="17"&gt;&amp;nbsp;Phosphorous&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Uric Acid" id="18"&gt;&amp;nbsp;Uric Acid&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="CPK" id="19"&gt;&amp;nbsp;CPK&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="CPK-MB" id="20"&gt;&amp;nbsp;CPK-MB&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Cholesterol" id="21"&gt;&amp;nbsp;Cholesterol&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Triglyceride" id="22"&gt;&amp;nbsp;Triglyceride&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="HDL" id="23"&gt;&amp;nbsp;HDL&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="LDL" id="24"&gt;&amp;nbsp;LDL&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Amylase" id="25"&gt;&amp;nbsp;Amylase&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Cholinesterase" id="26"&gt;&amp;nbsp;Cholinesterase&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="LDH" id="27"&gt;&amp;nbsp;LDH&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="T3-Total" id="28"&gt;&amp;nbsp;T3-Total&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="T4-Total" id="29"&gt;&amp;nbsp;T4-Total&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="TSH" id="30"&gt;&amp;nbsp;TSH&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Vitamin B12" id="31"&gt;&amp;nbsp;Vitamin B12&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="25-OH-Vitamin D" id="32"&gt;&amp;nbsp;25-OH-Vitamin D&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="FSH" id="33"&gt;&amp;nbsp;FSH&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="LH" id="34"&gt;&amp;nbsp;LH&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="Prolactin" id="35"&gt;&amp;nbsp;Prolactin&lt;br&gt;
  &lt;input type="checkbox" name="boxset[]" value="HbA1c" id="36"&gt;&amp;nbsp;HbA1c&lt;br&gt;
  </code></pre>