index.php:
Script:
<form name="form1" method="post" onsubmit="return checkPasswordMatch();" > <ul> <li> <label for="usermail">Email</label> <input name="usermail" size="40" required="" type="email" /> </li> <li> <label for="password">Password</label> <input type="password" id="txtNewPassword" size="40" required="required" autocomplete="off" name="password"></li> <li> <label for="password">Re-Password</label> <input type="password" autocomplete="off" size="40" id="txtConfirmPassword" required="required" name="password2"> </li> <p class="registrationFormAlert" style="color:#F00; font-size:16px; margin:3px;" id="divCheckPasswordMatch"> </p> <p align="center"><input type="submit" value="Sign up" name="go"></p> </ul> </form>
Script:
function checkPasswordMatch() { var password = $("#txtNewPassword").val(); var confirmPassword = $("#txtConfirmPassword").val(); if (password != confirmPassword) { $("#divCheckPasswordMatch").html("Passwords do not match! Try Again ") document.oo.password2.focus(); return false; } else { $("#divCheckPasswordMatch").html("Passwords match. GOOD"); } }
Great post thanks for sharing!! JioFiLocalHtml
ReplyDelete