title: document.getElementById("ID").value not working
body: <p>I need your help. I have a very simple problem that I cant figure out.Its hard to explain but I have a comment on a line and I hope you will understand it.  here is my code. sorry for the long post but I cant seem to get out of this hole. </p>
  
  <pre><code>function CheckLength()
  {
    var stringpassword = document.getElementById('Pass').value;
    alert(document.getElementById('Pass').value);   --&gt; this part is only printing a blank. 
    /*    
    if(document.getElementById("Pass").value.length &gt; 8)
    {
      return true;
    }
    else
    {
      alert(document.getElementById("Pass").value.length);
      return false;
    }
    */
  }
  
  function Check(a) 
  { 
    switch(a)
    {
      case 1 : 
        var first = document.getElementById("Uname").value.toUpperCase().indexOf(document.getElementById("Fname").value.toUpperCase());
        var last = document.getElementById("Uname").value.toUpperCase().indexOf(document.getElementById("Lname").value.toUpperCase());
        if(first !=-1 || last != -1)
        {
      alert("huy mali ang username. bawal yan pre");
      document.getElementById("Uname").value = "";
        }
        break; 
  
      case 2 :
        var gate = 0;
        var first = document.getElementById("Pass").value.toUpperCase().indexOf(document.getElementById("Fname").value.toUpperCase());
        var last = document.getElementById("Pass").value.toUpperCase().indexOf(document.getElementById("Lname").value.toUpperCase());
  
        if(first !=-1 || last != -1)
        {
          alert("mali dahil sa name");
          gate++;
        }
        if(!CorrectPassword())
        {     
          gate++;
        }
        if(!CheckLength())
        {    
          gate++;
        }
  
        if(gate != 0)
        {
      alert("Please follow password policy");
          document.getElementById("Pass").value="";
        }
        break;
  
      case 3:
        if(document.getElementById("Pass").value != document.getElementById("Rpass").value)
        {
      document.getElementById("Rpass").value = "";
        }
        break;
    }
  }
  </code></pre>
  
  <p>somewhere in the body :</p>
  
  <pre><code>&lt;input type="Password" placeholder="Password" value="" id="Pass" onblur="Check(2)"/&gt;
  </code></pre>
  
  <p>but when I try it. after typing on the password field.then clickng somehwere else. the alert box only returns a blank alert box. even the simple assignment statement is not working? forgive me for my bad english</p>