TypeError:验证程序未定义错误在Firefox中发生

时间:2015-11-19 11:32:03

标签: javascript jquery google-chrome firefox

我有以下表格:

enter image description here

但现在,一旦我点击“转到下一部分”按钮,我就没有得到任何回复而且我无法转到下一页,因为我收到了以下错误。

enter image description here

但此错误仅在Firefox中出现。我改用Chrome后,就可以了。

这是示例HTML:

 <div class="section">
   ....
 </div>  

 <div class="section">
   ....
 </div> 
 <button type="button" class="btn btn-warning">Go to Next Section</button>

这是剧本:

$('.btn-warning').click(function () {
    var container = $(this).closest('.section');
    var isValid = true;
    $.each(container.find('.form-control'), function () {
        $('form').validate().element($(this));
        if (!$(this).valid()) {
            isValid = false;
            return false;
        }
    });

    if (isValid) {
        container.next('.section').show().find('input').first().focus();
        container.hide();
    } else {
        container.find('.error').text('please complete');
    }
});

0 个答案:

没有答案