How layui determines password inconsistency

Release: 2019-07-31 08:59:38
Original
7665 people have browsed it

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>
Copy after login

js:

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template