jQuery-Mask-Plugin
jQuery-Mask-Plugin copied to clipboard
Mask DDD
utils.prototype.maskDdd = (function (object) { object.forEach(function (name) { var behavior = function (val) { return val.replace(/\D/g, '').length === 3 ? '(000)' : '(009)'; }, options = { onKeyPress: function (val, e, field, options) { field.mask(behavior.apply({}, arguments), options); }, clearIfNotMatch: true }; $(name).mask(behavior, options); }); });
how to make the dynamic mask of 2 and 3 numbers with caracters at the beginning and end of the mask?
thanks you