search
HomeWeb Front-endLayui TutorialHow layui determines password inconsistency

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version