title: Why Won't Disable Button Work
body: <p>OK, so I have a button that needs to be disabled. I wrote a JavaScript function that is meant to detect if a field is blank/null, and if it is disable the save button next to a field. It would appear to be working as far as detecting the blank field, and throwing the alert, but no matter what I try as far as setting the button to disable. I cannot get it to do so.</p>
  
  <p>Here is what I'm currently trying...</p>
  
  <pre class="lang-js prettyprint-override"><code>function validateBlank(){
    var x = document.forms["FuForm"]["Field1"].value;
    if (x=null || x == "") {
      alert("Must Be Between 1 and 300 Characters");
      document.getElementById("saveTest").setAttribute("disabled", "disabled");
      return false;
    }
  }
  </code></pre>
  
  <p>I've also tried this variant...</p>
  
  <pre class="lang-js prettyprint-override"><code>document.getElementById("saveTest").disabled
  </code></pre>
  
  <p>and the button/link is setup like this.</p>
  
  
  
  <pre><code>&lt;a href="#"&gt;
   &lt;img id="saveButton" src="${contextPath}/img/icon_sav.gif" name="saveTest" " alt="Disk icon. Save change" title="Save change"/&gt;
  &lt;/a&gt;
  </code></pre>