Sha256: 6d02cf4c2a1defe5390b6c9422bd010ae947d531d596da04035d5df243bbdbf8
Contents?: true
Size: 978 Bytes
Versions: 4
Compression:
Stored size: 978 Bytes
Contents
(function($) { $.fn.bootstrapValidator.i18n.hexColor = $.extend($.fn.bootstrapValidator.i18n.hexColor || {}, { 'default': 'Please enter a valid hex color' }); $.fn.bootstrapValidator.validators.hexColor = { enableByHtml5: function($field) { return ('color' === $field.attr('type')); }, /** * Return true if the input value is a valid hex color * * @param {BootstrapValidator} validator The validator plugin instance * @param {jQuery} $field Field element * @param {Object} options Can consist of the following keys: * - message: The invalid message * @returns {Boolean} */ validate: function(validator, $field, options) { var value = $field.val(); if (value === '') { return true; } return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(value); } }; }(window.jQuery));
Version data entries
4 entries across 4 versions & 2 rubygems