$(document).ready(function () { var validateConfiguration = { highlight: function (element, errorClass, validClass) { return $(element).closest('.control-group').removeClass('success').addClass('error'); }, unhighlight: function (element, errorClass, validClass) { return $(element).closest('.control-group').removeClass('error').addClass('success'); }, success: function (label) { return $(label).closest('form').find('.valid').removeClass('invalid'); }, errorPlacement: function (error, element) { return element.closest('.control-group').find('.error-wrapper').html(error.text()); }, onkeyup: function (element) { return true; }, onfocusout: function (element) { $(element).valid(); } }; $('.callbackForm').validate(validateConfiguration); });