Uncaught TypeError: element.removeClass is not a function In Jquery

Uncaught TypeError: element.removeClass is not a function In Jquery

我使用这个 Sample 来验证我的表单,但是遇到了这个错误:

未捕获类型错误:element.removeClass 不是函数 说 removeClass() 不是函数!! 我很困惑

我的Js代码:

$(function () {
            var form = $('#CompanyStep')
              , formData = $.data(form[0])
              , settings = formData.validator.settings
              , oldErrorPlacement = settings.errorPlacement
              , oldSuccess = settings.success;

            settings.errorPlacement = function (label, element) {

                debugger;
                oldErrorPlacement(label, element);

                label.parents('.form-group').addClass('has-danger');
                label.addClass('text-danger');
                element.addClass('form-control-danger');
            };

            settings.success = function (label, element) {

                debugger;

                label.parents('.form-group').removeClass('has-danger');
                label.parents('.form-group').addClass('has-success');
                element.removeClass('form-control-danger');
                element.addClass('form-control-success');


                oldSuccess(label, element);
            };
        });

发布我的评论作为答案

改为尝试:

$(element).removeClass('form-control-danger');