Sha256: 2d95dc28c722d828f4675b5d065450cf099a9489060fc3a597a6ccc3824fcb49

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

(function($) {
    $.fn.bootstrapValidator.i18n.digits = $.extend($.fn.bootstrapValidator.i18n.digits || {}, {
        'default': 'Please enter only digits'
    });

    $.fn.bootstrapValidator.validators.digits = {
        /**
         * Return true if the input value contains digits only
         *
         * @param {BootstrapValidator} validator Validate plugin instance
         * @param {jQuery} $field Field element
         * @param {Object} [options]
         * @returns {Boolean}
         */
        validate: function(validator, $field, options) {
            var value = $field.val();
            if (value === '') {
                return true;
            }

            return /^\d+$/.test(value);
        }
    };
}(window.jQuery));

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
bootstrap_validator_rails-0.1.0 vendor/assets/javascripts/validator/digits.js
bootstrap_validator_rails-0.0.6 vendor/assets/javascripts/validator/digits.js
bootstrap_validator_rails-0.0.5 vendor/assets/javascripts/validator/digits.js
bootstrap_validator-rails-0.0.1 vendor/javascripts/validator/digits.js