Demo

Mask tokens and editing

Documented in MaskedField.

Mask tokens and editing

MaskedField custom tokens from a RegExp and from a string of allowed characters, details.masked and formatMasked, and the caret rules for typing, deleting and pasting.

Token H accepts 0-9 and a-f
Raw "1e90ff" · details.masked "#1e90ff" · last change: none
Token D accepts N, S, E or W (typed letters are upper-cased)
Paste 4155550123 or (415) 555-0123; Backspace clears the previous digit without shifting the rest
formatMasked('+1 (000) 000-0000', raw) = "+1 (415) 555-0123"