i need code to check the password policy using javascript for my change password page
and the password policy should :
length of password :10-12 min 1 uppaercase min 1 lowercase min 1 special char and min 1 integer please reply soon.....
This way
<input type="text" id="textbox1" value="Pass@1234" /> <input type="button" id="Validate" onclick="ValidatePassword()" value="Validate" /> <script type="text/javascript"> function ValidatePassword() { var regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[#$@!%&*?])[A-Za-z\d#$@!%&*?]{10,12}$/; var txt = document.getElementById("textbox1"); if (!regex.test(txt.value)) { alert("Password strength is not good."); } else { alert("Password strength is good."); } } </script>
Demo
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.