title: check all checkboxes in a parent div, onclick using jQuery based on selectbox value
body: <p>Here i want to solve two issues,</p>
  
  <ol>
  <li>I've got a bunch of checkboxes, I would like to restrict the user to check the checkboxes based on selectbox value.</li>
  <li>There are two div.checkbox, i want to check all checkboxes while clicking on parent div based on selectbox value</li>
  </ol>
  
  <p>From above, i have solved first issue.</p>
  
  <p>but how can i solve second one</p>
  
  <p>Demo: <a href="http://jsfiddle.net/naresh_k28/HNmhL/13/" rel="nofollow">Fiddle</a></p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;select id="count"&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;option value="2"&gt;2&lt;/option&gt;
      &lt;option value="3"&gt;3&lt;/option&gt;
      &lt;option value="4"&gt;4&lt;/option&gt;
      &lt;option value="5"&gt;5&lt;/option&gt;
      &lt;option value="6"&gt;6&lt;/option&gt;
  &lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
  
  &lt;div class="checkbox" style='float:left;background:yellow;width:100px'&gt;
    &lt;input id="checkbox-1" type="checkbox" name="Data1" value="option1" /&gt;
    &lt;label for="checkbox-1"&gt;HTML&lt;/label&gt;
    &lt;br /&gt;
    &lt;input id="checkbox-2" type="checkbox" name="Data2" value="option2" /&gt;
    &lt;label for="checkbox-2"&gt;CSS&lt;/label&gt;
     &lt;br /&gt; 
      &lt;input id="checkbox-3" type="checkbox" name="Data3" value="option3" /&gt;
    &lt;label for="checkbox-3"&gt;HTML&lt;/label&gt;
    &lt;br /&gt;
  &lt;/div&gt;
  
  &lt;div class="checkbox" style='float:left;margin-left:100px;background:brown;width:100px'&gt;
    &lt;input id="checkbox-4" type="checkbox" name="Data4" value="option4" /&gt;
    &lt;label for="checkbox-4"&gt;CSS&lt;/label&gt;
      &lt;br /&gt;
       &lt;input id="checkbox-5" type="checkbox" name="Data5" value="option5" /&gt;
    &lt;label for="checkbox-5"&gt;HTML&lt;/label&gt;
    &lt;br /&gt;
    &lt;input id="checkbox-6" type="checkbox" name="Data6" value="option6" /&gt;
    &lt;label for="checkbox-6"&gt;CSS&lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>$(document).ready(function(){
      $('#count').on('change', function(){
          $('input[type=checkbox]').prop('checked', false);
      });
  
      $('input[type=checkbox]').on('change', function(){
          if($('input[type=checkbox]:checked').length &gt; $('#count').val()){
              $(this).prop('checked', false);
          }
      });
  });
  </code></pre>
  
  <p>Can anyone help me out.</p>