title: Disabling Checkboxes after selecting the max selection using jquery
body: <p>I am trying to make this multidimensional array checkbox to disable after selecting the max number of selection.</p>
  
  <p>the problem is I don't know where the problem is in this jquery code. </p>
  
  <p>Any kind of help is appreciated. thank you :D</p>
  
  <p>here is my code.</p>
  
  <pre><code>&lt;script&gt;
  $("input[name=chkservicecrew\\[&lt;?php echo $ar_serviceID_count;?&gt;\\]\\[\\]]").change(function(){
  var max=  &lt;?php echo $maxSelectedCrew;?&gt;;
      if( $("name=chkservicecrew\\[&lt;?php echo $ar_serviceID_count;?&gt;\\]\\[\\]]]:checked").length == max ){
      $("name=chkservicecrew\\[&lt;?php echo $ar_serviceID_count;?&gt;\\]\\[\\]]").attr('disabled', 'disabled');
      $("name=chkservicecrew\\[&lt;?php echo $ar_serviceID_count;?&gt;\\]\\[\\]]:checked").removeAttr('disabled');
      }else{
      $("name=chkservicecrew\\[&lt;?php echo $ar_serviceID_count;?&gt;\\]\\[\\]]").removeAttr('disabled');
      }
  });
  &lt;/script&gt;
  </code></pre>