Sha256: e369428be01c068c6a1edb7ccad6c1d4c404bc1779c1a10d91de0a3c5c825e0d
Contents?: true
Size: 1.44 KB
Versions: 54
Compression:
Stored size: 1.44 KB
Contents
/** * Masked input wrapper. * * @author Htmlstream * @version 1.0 * */ ;(function ($) { 'use strict'; $.HSCore.components.HSMaskedInput = { /** * * * @var Object _baseConfig */ _baseConfig: {}, /** * * * @var jQuery pageCollection */ pageCollection: $(), /** * Initialization of Masked input wrapper. * * @param String selector (optional) * @param Object config (optional) * * @return jQuery pageCollection - collection of initialized items. */ init: function (selector, config) { this.collection = selector && $(selector).length ? $(selector) : $(); if (!$(selector).length) return; this.config = config && $.isPlainObject(config) ? $.extend({}, this._baseConfig, config) : this._baseConfig; this.config.itemSelector = selector; this.initMaskedInput(); return this.pageCollection; }, initMaskedInput: function () { //Variables var $self = this, collection = $self.pageCollection; //Actions this.collection.each(function (i, el) { //Variables var $this = $(el), mask = $this.data('mask'), placeholder = $this.attr('placeholder'); $this.mask(mask, { placeholder: placeholder ? placeholder : false }); //Actions collection = collection.add($this); }); } }; })(jQuery);
Version data entries
54 entries across 54 versions & 1 rubygems