验证新密码并确认密码

时间:2019-05-06 07:53:57

标签: javascript jquery

我需要验证新密码并按照以下条件确认密码。

使用8至16个字符 密码至少应包含1个数字和1个字母 特殊字符 密码区分大小写

<div class="panel-body">
    <div class="Container">
        <span class="Heading"> Create a New Password </span>
     <form method="post" name="sentEmailForm" id="resetPasswordForm" action = "/reset-password?q=<?php echo $qhffj; ?>">  
        <div class="col-sm-12 p-0 mbottom20">
            <div class="col-sm-2 p-0 left">  <label>Enter New Password</label> </div>
                    <div class="col-sm-10 p-0 right">   <input type="password" name="password" id = "password" class="" /><br/> </div>
        </div>
         
         <div class="col-sm-12 p-0 mbottom20">
             <div class="col-sm-2 p-0 left">   <label>Confirm Password</label> </div>
                 <div class="col-sm-10 p-0 right">   <input type="password" name="confirmpassword" id ="confirmpassword" class="" /><br/> </div>
        </div>
        <div class="col-sm-12 p-0">
            <div class="col-sm-2 p-0 left">   </div>
                <div class="col-sm-10 p-0 greycolor right"> 
                    <span class="bullet"> Use 8 to 16 character </span><br>
                    <span class="bullet"> Password should contain at least 1 numeric and 1 alphabet </span><br>
                    <span class="bullet"> Special Character </span><br>
                    <span class="bullet"> Password is case sensitives </span><br>
                    <input type="submit" value="Create Password" class="btn btn-primary" ></input> 
                </div>
        </div>

        <div class="clearfix"></div>
    </form>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

您可以使用input type = "password"上的pattern attribute来验证在表单中插入的数据。该模式接受正则表达式,您可以test here