title: Bootstrap Multiselect plugin and disabling/enabling checkboxes on the change event
body: <p>I'm using <a href="http://davidstutz.github.io/bootstrap-multiselect/" rel="nofollow">Bootstrap Multiselect</a> to show a list of years where the maximum count of selected years can be 4. Ie. if 4 years have been selected, disable all the unselected years ; if a year has been unselected to make the count 3, enable all the years again.</p>
  
  <p>(The latest commit on that plugin's project was to add an enable/disable feature but I don't think that's for individual select elements - <a href="https://github.com/davidstutz/bootstrap-multiselect/issues/171" rel="nofollow">https://github.com/davidstutz/bootstrap-multiselect/issues/171</a>)</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;select id="slYears" class="multiselect" multiple="multiple"&gt;
      &lt;option value="1" disabled="disabled"&gt;2009&lt;/option&gt;
      &lt;option value="2" selected="selected"&gt;2010&lt;/option&gt;
      &lt;option value="3" selected="selected"&gt;2011&lt;/option&gt;
      &lt;option value="4" selected="selected"&gt;2012&lt;/option&gt;
      &lt;option value="5" selected="selected"&gt;2013&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>My JavaScript (first attempt):</p>
  
  <pre><code>$('#slYears').change(function () {
      var arr = $(this).val().toString().split(',');
      if (arr.length &gt;= 4) {
          $('#slYears option').each(function () {
              if (!$(this).is(':selected')) {
                  $(this).prop('disabled', true);
              }
          });
      }
      else {
          $('#slYears option').each(function () {
              $(this).prop('disabled', false);
          });
      }
  });
  </code></pre>
  
  <p>Then I tried using some of the plugin's methods and examples. I tried using the 'select all' example to enable all, I tried using the 'onchange' event, but none of it works.</p>
  
  <p>Here is the jsfiddle: <a href="http://jsfiddle.net/389Af/1/" rel="nofollow">http://jsfiddle.net/389Af/1/</a> (note I pasted the plugin JS before the above JS)</p>