title: How to limit checkbox selection to one using jquery or javascript
body: <p>How to limit checkbox selection to one using jquery or javascript  and other checkbox should be disabled after one checkbox selected?</p>
  
  <pre><code>&lt;input type="checkbox" name="size[]" id="size" value="Small" /&gt;Small
  &lt;input type="checkbox" name="size[]" id="size" value="Medium" /&gt;Medium
  &lt;input type="checkbox" name="size[]" id="size" value="Large" /&gt;Large
  &lt;input type="checkbox" name="size[]" id="size" value="Xl" /&gt;XL
  </code></pre>
  
  <p><strong>Here The Example But I Want Same Thing In Html Or Php</strong></p>
  
  <pre><code>http://gravitywiz.com/demos/limit-how-many-checkboxes-can-be-checked/
  </code></pre>
  
  <p><strong>Problem Is Solved Now Here The Final Solution</strong></p>
  
  <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;
  &lt;/script&gt;
  
  &lt;script&gt;
  $(document).ready(function () {
  $('input:checkbox').click(function(){
  var $inputs = $('input:checkbox')
  if($(this).is(':checked')){
  $inputs.not(this).prop('disabled',true); 
  }else{
  $inputs.prop('disabled',false);
  }
  })
  })
  &lt;/script&gt;
  
  &lt;input type="checkbox"&gt;
  &lt;input type="checkbox"&gt; 
  &lt;input type="checkbox"&gt;
  &lt;input type="checkbox"&gt;
  &lt;input type="checkbox" /&gt;
  </code></pre>