If you have a form with a ‘confirm password’ field or ‘confirm email’, and you don’t want to use a heavy validation plugin just for a simple confirmation like this, you can always use some simple ‘old school’ javascript and the onblur event, so when the field loses focus triggers the validation function.
<script type="text/javascript"> function confirmPass() { var pass = document.getElementById("pass").value var confPass = document.getElementById("c_pass").value if(pass != confPass) { alert('Wrong confirm password !'); } } </script> <form id="form" action="" method="post"> <label for="pass">Password</label> <input type="password" id="pass" class="text" name="your_pass" value=""/> <label for="c_pass">Confirm Password</label> <input type="password" id="c_pass" class="text" name="your_c_pass" value="" onblur="confirmPass()"/> </form>
See a demo.