I Using This Sample For Validate My form, But Got this Error:
Uncaught TypeError: element.removeClass is not a function says removeClass() Is Not Function !! I'm confused
My Js Code :
$(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);
};
});
Posting my comment as answer
Instead try:
$(element).removeClass('form-control-danger');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With