title: Jquery to disable a HTML button not working
body: <p>I am trying to get some jQuery to disable the confirm button on my form if the dropdown list is a certain value, but it doesnt seem to be working.</p>
  
  <p>I have read lots of posts on here and tried various different ways.</p>
  
  <p>Here is my code at the moment:</p>
  
  <pre><code>    &lt;script&gt;
         $(document).ready(function () {
         // Handler for .ready() called.
         $('#MoveToCompanyId').attr("disabled", true);
  
         $('#DeleteAll').live("click", function () {
  
             if ($(this).attr("value") == "True") {
                   $('#MoveToCompanyId').attr("disabled", true);
             } else {
                   $('#MoveToCompanyId').attr("disabled", false);
                   $('#confirm').attr("disabled", true);
                   $('#MoveToCompanyId').change(function () {
                       if ($("#MoveToCompanyId option:selected").text() != "---Select Company---") {
                      $('#confirm').removeAttr("disabled");
                      alert($("#MoveToCompanyId option:selected").text());
                  }
                  else {
                      $('#confirm').attr("disabled", true);
                      alert("I should be disabled!");
                  }
  
              });
          }
          });
       });
  
      &lt;/script&gt;
  </code></pre>
  
  <p>Can anyone see any problems with it?</p>
  
  <p>Just to clarify, i know it gets into the correct code blocks as my alerts are working. Its just the button disabling that is not working.</p>
  
  <p>Kind Regards,</p>
  
  <p>Gareth</p>