title: disable form submit button when password does not match
body: <p>I'm trying to figure out where I'm supposed to include a js code where I disable the form submit button when the passwords don't match.</p>
  
  <p>html:</p>
  
  <pre><code>&lt;form name=passform class="form-horizontal-signup" method="post" action="login.php" &gt;
  
  
  
      &lt;fieldset&gt;
      &lt;legend&gt;Sign Up for MyVibes&lt;/legend&gt;
      &lt;input type="password" class="input-xlarge" placeholder="Password" name="password" id="password" onKeyUp="verify.check()" /&gt;
      &lt;input type="password" class="input-xlarge" placeholder="Retype Password" name="repassword" id="repassword" onKeyUp="verify.check()"/&gt;&lt;/fieldset&gt;
      &lt;div id="password_result"&gt;&amp;nbsp; &lt;/div&gt;&lt;br /&gt;
      &lt;button type="submit" input name="btnSignUp" id="btnSignUp" class="btn btn-inverse" disabled="disabled"/&gt;Sign Up&lt;/button&gt;
      &lt;/form&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>getting the variables:</p>
  
  <pre><code>&lt;SCRIPT TYPE="text/javascript"&gt;
  
  
              verify = new verifynotify();
              verify.field1 = document.passform.password;
              verify.field2 = document.passform.repassword;
              verify.result_id = "password_result";
              verify.match_html = "Passwords match.";
              verify.nomatch_html = "Please make sure your passwords match.";
  
              // Update the result message
              verify.check();
  
              //
              &lt;/SCRIPT&gt;
  </code></pre>
  
  <p>and the function:</p>
  
  <pre><code>function verifynotify(field1, field2, result_id, match_html, nomatch_html) {
   this.field1 = field1;
   this.field2 = field2;
   this.result_id = result_id;
   this.match_html = match_html;
   this.nomatch_html = nomatch_html;
  
   this.check = function() {
  
     // Make sure we don't cause an error
     // for browsers that do not support getElementById
     if (!this.result_id) { return false; }
     if (!document.getElementById){ return false; }
     r = document.getElementById(this.result_id);
     if (!r){ return false; }
  
     if (this.field1.value != "" &amp;&amp; this.field1.value == this.field2.value) {
       r.innerHTML = this.match_html;
        $("#btnSignUp").prop("disabled", false);
  
     } else {
       r.innerHTML = this.nomatch_html;
        $("#btnSignUp").prop("disabled", true);
  
     }
   }
  }
  </code></pre>
  
  <p>maybe i misplace where i'm supposed to put the  $("#btnSignUp").prop("disabled", true); code?</p>