(function($) { $.fn.bootstrapValidator.validators.callback = { /** * Return result from the callback method * * @param {BootstrapValidator} validator The validator plugin instance * @param {jQuery} $field Field element * @param {Object} options Can consist of the following keys: * - callback: The callback method that passes 2 parameters: * callback: function(fieldValue, validator) { * // fieldValue is the value of field * // validator is instance of BootstrapValidator * } * - message: The invalid message * @returns {boolean} */ validate: function(validator, $field, options) { var value = $field.val(); if (options.callback && 'function' == typeof options.callback) { return options.callback.call(this, value, this); } return true; } }; }(window.jQuery));