找到你要的答案

Q:Guidance bootstrap validator not work with nav nav-tabs

Q:指导引导验证器不能与资产净值NAV标签

Guidance bootstrap validator not work with nav nav-tabs help me

I've created a form that is divided in 4 tabs, and i've added the bootstrap validator to the form to test the validity on the input.

On this jsfiddle.net i've recreated part of the form.

When you press submit without entering any data into the form, it will display the X symbol and color the input red.

指导引导验证器不能与资产净值NAV标签 help me

我创建了一个分4个标签的形式,我已经添加到引导器来对输入的有效性检验。

在这jsfiddle.net我创建表单的一部分。

当你按提交而不输入任何数据到表单中,它将显示x符号和颜色输入红色。

answer1: 回答1:
.on('status.field.bv', function(e, data) {
        var $form     = $(e.target),
            validator = $form.data('bootstrapValidator'),
            $tabPane  = data.element.parents('.tab-pane'),
            tabId     = $tabPane.attr('id');
        if (tabId) {
            var $icon = $('a[href="#' + tabId + '"][data-toggle="tab"]').parent().find('i');
            // Add custom class to tab containing the field
            if (data.status == validator.STATUS_INVALID) {
                $icon.removeClass('fa-check').addClass('fa-times');
            } else if (data.status == validator.STATUS_VALID) {
                var isValidTab = validator.isValidContainer($tabPane);
                $icon.removeClass('fa-check fa-times')
                     .addClass(isValidTab ? 'fa-check' : 'fa-times');
            }
        }
});
.on('status.field.bv', function(e, data) {
        var $form     = $(e.target),
            validator = $form.data('bootstrapValidator'),
            $tabPane  = data.element.parents('.tab-pane'),
            tabId     = $tabPane.attr('id');
        if (tabId) {
            var $icon = $('a[href="#' + tabId + '"][data-toggle="tab"]').parent().find('i');
            // Add custom class to tab containing the field
            if (data.status == validator.STATUS_INVALID) {
                $icon.removeClass('fa-check').addClass('fa-times');
            } else if (data.status == validator.STATUS_VALID) {
                var isValidTab = validator.isValidContainer($tabPane);
                $icon.removeClass('fa-check fa-times')
                     .addClass(isValidTab ? 'fa-check' : 'fa-times');
            }
        }
});
php  jquery  html  css