You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

text-mask-all

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-mask-all

Conforms string to given mask or pattern, and can be hooked up to input element


Version published
Maintainers
1
Created

Readme

Source

Text Mask

Build Status

Text Mask let's you turn a plain <input />, into one that conforms any user input, as they type, to a given mask pattern.

Live demo

To see Text Mask in action, checkout the demo page.

Installation and usage

Features

Expected to work with...

IE9+, Android, Samsung Internet, Windows Phone, iOS, Opera, Firefox, Safari, and Chrome

Masking characters

CharacterDescription
1Any number
AAny letter
?Any number or letter
UAny letter (will be transformed to uppercase)
LAny letter (will be transformed to lowercase)
Escapable masking characters

The mask also supports escaping, so you can use a masking character within the mask. For example

+\1 (111) 111-1111

The first 1 is not a masking character but part of the mask. For more information, see the documentation here.

Guide mode

Guide mode prints out placeholder characters and the mask itself as the user types

No-guide mode

No-guide mode doesn't print out placeholder characters and only adds mask characters when the user reaches them

Ability to customize placeholder character

You can change the placeholder character from _ (underscore) to anything you want. For example, you can use the unicode character U+2000 (\u2000 in JavaScript), which is white space to create a mask for phone number that looks like

+1 (   )    -    

Or for date

  /  /    

Other features

  • Accepts custom validator
  • Supports pasting
  • Supports browser auto-fill
  • It is small, around 3KB gzipped
  • Has no dependencies

For support, questions, or suggestions

Please file an issue or tweet at me.

License

Public domain - CC0 1.0 Universal

Keywords

FAQs

Package last updated on 26 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc