Skip to content

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

Description

@xrc234
账号:<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里,就不会出现那种情况。由上匹配下没问题,由下匹配上就会出现问题

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions