title: Allow user to select the number of checkboxes equal to the value of a text input
body: <p>you want help me, I have a form where I have an input text and 4 chechbox, what I do is, if you write a value in the input, is the same number of checked I can make the checkbox, eg write the value 3 in the input and in the group of checkbox only allows me to select any 3 boxes and missing fourth box is off or you can not do checked.</p>
  
  <p>thanks and regards.</p>
  
  <p>HTML: </p>
  
  <pre><code>    &lt;input id="iddata_13561" name="data_13561" type="text" value="" &gt;
  
      &lt;input name="data" id="iddata_13562" type="checkbox"  value="1"&gt;
      &lt;input name="data" id="iddata_13570" type="checkbox"  value="1"&gt;
      &lt;input name="data" id="iddata_13578" type="checkbox"  value="1"&gt;
      &lt;input name="data" id="iddata_13586" type="checkbox"  value="1"&gt;
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>     $(document).ready(function () {
             $("input[name='tech']").change(function () {
  
                var maxAllowed = $('#iddata_13561').attr('value');
  
                var cnt = $("input[name='tech']:checked").length;
  
               if (cnt &gt; maxAllowed)
                {
                   $(this).prop("checked", "");
                   alert('Select maximum ' + maxAllowed + ' technologies!');
               }
            });
          });
  </code></pre>