VanillaMasker is a simple and pure javascript library to mask your input elements. It's a cross-browser and cross-device library.
Website Demo