Home >Web Front-end >Layui Tutorial >How layui determines password inconsistency

How layui determines password inconsistency

尚
Original
2019-07-30 16:31:357709browse

How layui determines password inconsistency

Layui determines whether the passwords entered twice are consistent when registering: After submitting the password data in the form, Layui compares the passwords entered twice by calling js code and determines Is it consistent?

1. Confirm password

html:

<div class="layui-form-item">
  <div class="layui-inline">
	<label class="layui-form-label">登录密码</label>
	<div class="layui-input-inline">
	  <input type="password" name="password"  lay-verify="required" class="layui-input">
	</div>
  </div>
  <div class="layui-inline">
	<label class="layui-form-label">确认密码</label>
	<div class="layui-input-inline">
	  <input type="password" lay-verify="required|confirmPass" class="layui-input">
	</div>
  </div>
</div>

js:

// 校验两次密码是否一致
form.verify({
    confirmPass:function(value){
        if($(&#39;input[name=password]&#39;).val() !== value)
            return &#39;两次密码输入不一致!&#39;;
    }
});

Recommended: layuiframeworktutorial

The above is the detailed content of How layui determines password inconsistency. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn