title: How to disable options in select2
body: <p>I want to take user's preference with select2. Upon selecting one option the option in other select2 should disable. </p>
  
  <p>Sample:</p>
  
  <p>Preference 1:
  Option 1
  Option 2
  Option 3
  Option 4</p>
  
  <p>Preference 2:
  Option 1
  Option 2
  Option 3
  Option 4</p>
  
  <p>Preference 3:
  Option 1
  Option 2
  Option 3
  Option 4</p>
  
  <p>Preference 4:
  Option 1
  Option 2
  Option 3
  Option 4</p>
  
  <p>If I select option 1 in preference 1 it should disable in preferences 1,2,3,4
  and if I select option 2 in preference 2 it should disable in preferences 1,2,3,4
  and if I select option 3 in preference 3 it should disable in preferences 1,2,3,4</p>
  
  <p>Again and if I select option 4 in preference 2 it should disable in preferences 1,2,3,4 and option 2 should be available for select in Preferences 3&amp;4.</p>
  
  <p>I have tired various implementations but stuck. Help me out.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="form-group col-md-6 m-t-sm"&gt;
      &lt;label&gt; Select Preference 1: &lt;/label&gt;
      &lt;select class="form-control" id="pref1" name="pref1" style="width:100%"&gt;
      &lt;option value=""&gt; Select Campus Preference 1 &lt;/option&gt;
      &lt;option value="N"&gt; N &lt;/option&gt;
      &lt;option value="O"&gt; O &lt;/option&gt;
      &lt;option value="R"&gt; R &lt;/option&gt;
      &lt;option value="S"&gt; S &lt;/option&gt;
      &lt;/select&gt;
      &lt;label id="pref1-error" class="error" for="pref1"&gt;&lt;/label&gt;
  &lt;/div&gt;
  .
  .
  .
  </code></pre>
  
  <p>My current js:</p>
  
  <pre><code>$('select[name*="pref"]').change(function(){
  
      // start by setting everything to enabled
      $('select[name*="pref"] option').prop('disabled',false);
  
      // loop each select and set the selected value to disabled in all other selects
      $('select[name*="pref"]').each(function(){ 
          var $this = $(this);
          $('select[name*="pref"]').not($this).find('option').each(function(){
             if($(this).attr('value') == $this.val()){            
                 $(this).prop('disabled',true);               
             }
          });
      });
  
  });
  </code></pre>