天天看點

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 '提示:兩次輸入密碼不一緻!';
    }
});      

繼續閱讀