phonenumber-formatter
v1.3.0
Published
A simple phonenumber formatter for HTML inputs
Downloads
2
Maintainers
Readme
phonenumber-formatter
A simple phonenumber formatter for HTML inputs. This package is meant for the front-end, so browserify or webpack will be necessary. It also only currently supports 10-digit numbers.
Installation
npm i phonenumber-formatter -S
Usage
<!-- index.html -->
<input type="text" id="phonenumber">
// app.js
var formatPhonenumbers = require('phonenumber-formatter')
formatPhonenumbers(document.getElementById('phonenumber'))
formatPhonenumbers
takes up to 2 arguments:
- the HTML input element to format
- a function to run after the formatting completes