MVC 中的注解验证 失去焦点就验证

Posted on 2014-01-26 19:43  哥德巴赫猜  阅读(302)  评论(0编辑  收藏  举报

重新改写jquery.validate.unobtrusive.js

$.validator.setDefaults({
    //光标移出时
    onfocusout: function (element) {
        this.element(element);
    },
    //光标移入时
    onfocusin: function (element, event) {
        //找到显示错误提示的标签并移除,针对jquery.validate.unobtrusive
        var errorElement = $(element).next('span.field-validation-error');
        if (errorElement) {
            errorElement.children().remove();
        }
    },
    onkeyup: function (element, event) {
    }
});

 

http://www.cnblogs.com/dudu/archive/2012/04/27/jquery_validate_unobtrusive_focusout_focusin.html

Copyright © 2024 哥德巴赫猜
Powered by .NET 9.0 on Kubernetes