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

target参数支持传递回调 #130

Closed
niceue opened this Issue Jun 28, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@niceue
Copy link
Owner

niceue commented Jun 28, 2014

某个字段的消息特殊处理

$("#form1").validator({
    fields: {
        province: {
            rule: 'required',
            target: function(el) {
                return $(el).next('select');
            }
        },
        city: 'required'
    }
});

自定义全部消息的target

$("#form1").validator({
    target: function(el) {
        var $formGroup = $(el).closest('div.form-group'),
            $msgbox = $formGroup.find('.msg-box');

        if (!$msgbox.length) {
            $msgbox = $('<span class="msg-box"></span>').appendTo($formGroup);
        }
        return $msgbox;
    },
    fields: {
        province: 'required',
        city: 'required'
    }
});

@niceue niceue closed this in 085993b Jun 28, 2014

@niceue niceue added feature labels Jun 28, 2014

@niceue niceue added this to the 0.7.3 milestone Jun 28, 2014

@niceue niceue modified the milestones: 0.8.0, 0.7.3 Oct 30, 2014

@niceue niceue added the new label Oct 30, 2014

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