title: jQuery - disable/enable select options
body: <p>I need some help with jquery if condition.
  I've been searching and testing for hours, any help would be great !!!
  I get this HTML code:</p>
  
  <pre><code>&lt;label id="label1" for="date_from"&gt;Value:&lt;/label&gt;
  &lt;input value="" /&gt;
  
  &lt;select id="select1" name="select1"&gt;
  &lt;option&gt;No Match&lt;/option&gt;
  &lt;option value="1"&gt;Test&lt;/option&gt;
  &lt;option value="2"&gt;Test 2&lt;/option&gt;
  &lt;option value="3"&gt;Test 3&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;select id="select2" name="select2"&gt;
  &lt;option&gt;No Match&lt;/option&gt;
  &lt;option value="1"&gt;Test&lt;/option&gt;
  &lt;option value="2"&gt;Test 2&lt;/option&gt;
  &lt;option value="3"&gt;Test 3&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>and this jquery function:</p>
  
  <pre><code>if ( $('#label1').val() &lt; 3 ) {
             $('select').change(function() {
  
              $('#select1, #select2').not(this)
                  .children('option[value=' + this.value + ']')
                  attr('disabled', true)
                  .siblings().removeAttr('disabled');
  
          });
  }
  else {
      $('select').change(function() {
  
          $('#select1, #select2').not(this)
              .children('option[value=' + this.value + ']')
              .attr('disabled', false)
              .siblings().removeAttr('disabled');
  
      });
  }
  </code></pre>
  
  <p>I'm a beginner in jquery, and I don't know is this code is written correctly because it doesn't work.</p>
  
  <p>The problem is:</p>
  
  <p>When the input value is less then 3 then select option in select2 is the same as in select1 and the rest of options in select2 are disable. When the input value is greater then 3 then options in select1 and select2 are enable.</p>
  
  <p>Best Regards, Thank you for reading this jquery newbie post... </p>