title: If check box checked disable other, if unchecked enable all JavaScript?
body: <p>I have group of checkbox buttons, if I click and check one I want other check boxes to be set to disable. Also if I click to the same and uncheck I want all of them to be enabled. My logic works if I checked the checkbox but if I click again all of them are disabled. Here is my code:</p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;&lt;input type="checkbox" name="progress" id="progress1" value="1" tabIndex="1" onClick="ckChange(this)"&gt;Test 1&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input type="checkbox" name="progress" id="progress2" value="1" tabIndex="1" onClick="ckChange(this)"&gt;Test 2&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input type="checkbox" name="progress" id="progress3" value="1" tabIndex="1" onClick="ckChange(this)"&gt;Test 3&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input type="checkbox" name="progress" id="progress4" value="1" tabIndex="1" onClick="ckChange(this)"&gt;Test 4&lt;/td&gt;&lt;/tr&gt;
  
  function ckChange(ckType){
          var ckName = document.getElementsByName(ckType.name);
  
          for(var i=0; i &lt; ckName.length; i++){
              if(!ckName[i].checked){
                  ckName[i].disabled = true;
              }else{
                  ckName[i].disabled = false;
              }
          } 
      }
  </code></pre>
  
  <p>My current code is failing to set disable attribute to true and false when check box is checked. If you see where is the problem in my code please let me know.
  I have tried to make this function to work for any set of checkboxes. If you see any way to improve this I would like to hear that. </p>