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>

JavaScript:

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