Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

错误信息显示在同一区域,文本框使用match点击提交按钮会一闪消失 #271

Open
xrc234 opened this issue Jun 26, 2018 · 0 comments

Comments

@xrc234
Copy link

xrc234 commented Jun 26, 2018

账号:<input  name="loginName" type="text"  />
密码:<input maxlength="20" name="pwd" type="password"  />
确认密码:<input maxlength="20" name="confrimPwd" type="password"  />
真实名称:<input  name="name" type="text"  />
 <span class="msg-box n-right" style="display:none;" id="msg-register">
        <span class="msg-wrap n-error" role="alert">

        </span>
</span>
   <button type="submit">注册</button>
</form>
$('#submitForm').validator({
    showOk: false,
    loadingMsg: '',
    ignore: ':hidden',
    target: '#msg-register',
    stopOnError: true,
    fields: {
        loginName: 'required;',
        name: 'required;',
        pwd: 'required;',
        confrimPwd: 'match(pwd);'
    },
     valid: function () {}
});

代码如上,密码不相同时,离开确认密码文本框时,错误信息会显示,不会消失。但是点击提交按钮时就会出现错误信息闪一下就消失的情况。但是如果把confrimPwd的match移到pwd里,就不会出现那种情况。由上匹配下没问题,由下匹配上就会出现问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant