天天看点

Layui表单账号注册校验密码是否一致

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

继续阅读