 <p>Use something similar:</p> <pre><code>if (pass1.value &amp;&amp; pass2.value &amp;&amp; pass1.value == pass2.value) { pass2.style.backgroundColor = goodColor; message.style.color = goodColor; message.innerHTML = "Passwords Match!" $("#submit").prop("disabled", false); } else { pass2.style.backgroundColor = badColor; message.style.color = badColor; message.innerHTML = "Passwords Do Not Match!" $("#submit").prop("disabled", true); } </code></pre> <p>I added two length checks (if value is <code>""</code> it is evaluated as false), and added the <code>#prop()</code> call to enable the button, when the two strings match.</p>