title: How do I enable/disable options in Select Box using jquery
body: <p>I have a select box which contains the options and <code>optgroup</code> that are generated dynamically using php.Now when I select "ALL" all the other <code>optgroup</code>, options should be disabled and when I select any option other than "ALL"  the "ALL" option should be disabled</p>
  
  <pre><code>&lt;select name="select1" id ="select1" onchange="handleSelect()"&gt;
      &lt;option value ="-1"&gt;ALL&lt;/option&gt;
      &lt;optgroup label="CARS"&gt;
          &lt;option value="ford"&gt;FORD&lt;/option&gt;
          &lt;option value="Nissan"&gt;Nissan&lt;/option&gt;
      &lt;/optgroup&gt;
  &lt;/select&gt;
  &lt;script&gt;
      function handleSelect() {
          var selectVal = $("#select1:selected").text();
          if (selectVal == "ALL") {
              // cannot disable all the options in select box
              $("#select1  option").attr("disabled", "disabled");
          }
          else {
              $("#select1 option[value='-1']").attr('disabled', 'disabled');
              $("#select1 option").attr('disabled', '');
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>How can I make this working?</p>