`

jquery.validation与nice validator

 
阅读更多
https://my.oschina.net/nice/blog/149557
https://validator.niceue.com/docs/getting-started.html
这两者之间的区别上面文章有
自己用到的
$('.simple_form').validator({
            rules: {
                aaaaa: function () {
                    return $('input[name="task[aaaaa]"]:checked').val() == "true";
                },
                money: function (element, param, field) {
                    var res;
                    if (param) {
                        res = this.rules[param[0]]();
                    } else {
                        res = true;
                    }
                    var val = parseFloat(element.value);
                    return !res || val > 0 || '请输入大于0的数';
                }
            },
            //待验证字段集合
            fields: {
                'task[name]': '名称:required;',
                'task[xxx_xxx]': 'xxxxxx:required(aaaaa);money(aaaaa);',
                'task[xxxx]': 'xxxx:required(aaaaa);money(aaaaa);'
            }
        });
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics