title: Format a phone number as a user types using pure JavaScript
body: <p>I've got an input field in the body of my document, and I need to format it as the user types. It should have parenthesis around the area code and a dash between the three and four digits after that.</p>
  
  <p>Ex: <code>(123) 456 - 7890</code></p>
  
  <p>As the user types it should look something like:</p>
  
  <p><code>(12</code><br>
  <code>(123)</code><br>
  <code>(123) 456</code><br>
  <code>(123) 456 - 78</code><br>
  <code>(123) 456 - 7890</code></p>