Sha256: 5b61d554d0d56d49c45fc62109c54e8098ae18ffd627b0da49c90e5a6dd1854e
Contents?: true
Size: 707 Bytes
Versions: 2
Compression:
Stored size: 707 Bytes
Contents
(function ($){ $.fn.regexMask = function (mask) { if (!mask) { throw 'mask is missing'; } else if (mask == 'float') { mask = /^-?(\d,)*\d*(\.\d*)?$/; } else if (mask == 'integer') { mask = /^-?\d*$/; } else { try { mask.test(""); } catch(e) { throw 'mask does not support test method'; } } $(this).keypress(function (event) { if (!event.charCode) return true; var part1 = this.value.substring(0,this.selectionStart); var part2 = this.value.substring(this.selectionEnd,this.value.length); if (!mask.test(part1 + String.fromCharCode(event.charCode) + part2)) return false; }); }; })(jQuery);
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
barkest_core-1.5.4.0 | app/assets/javascripts/barkest_core/masked_edit.js |
barkest_core-1.5.3.0 | app/assets/javascripts/barkest_core/masked_edit.js |