title: How would I check a password has met minimum requirements as its being typed in Javascript
body: <p>I want to validate a password as its being typed in javascript and let the user know when each requirement is met.</p>
  
  <p>My js code so far is</p>
  
  <pre><code>//Test password as its being typed
  $(document).ready(function () {    
  $("#password").keyup(ValidatePassword);
  });
  
  
  //recieve password
  function ValidatePassword() {
  var password = $("#password").val();
  
  
  }
  </code></pre>
  
  <p>I have a cs function which validates the password which I want to eventually call when this function is passed.</p>
  
  <p>Here is the validation I am using:</p>
  
  <pre><code>ublic static bool ValidatePassword(string password)
      {
          const int MIN_LENGTH = 8;
          const int MAX_LENGTH = 50;
  
          if (password == null) throw new ArgumentNullException();
  
          bool meetsLengthRequirements = password.Length &gt;= MIN_LENGTH &amp;&amp; password.Length &lt;= MAX_LENGTH;
          bool hasUpperCaseLetter = false;
          bool hasLowerCaseLetter = false;
          bool hasDecimalDigit = false;
  
          if (meetsLengthRequirements)
          {
              foreach (char c in password)
              {
                  if (char.IsUpper(c)) hasUpperCaseLetter = true;
                  else if (char.IsLower(c)) hasLowerCaseLetter = true;
                  else if (char.IsDigit(c)) hasDecimalDigit = true;
              }
          }
  
          bool isValid = meetsLengthRequirements
                      &amp;&amp; hasUpperCaseLetter
                      &amp;&amp; hasLowerCaseLetter
                      &amp;&amp; hasDecimalDigit
                      ;
          return isValid;
  
      }
  </code></pre>
  
  <p>I basically want this in javascript first so I can validate?</p>