Skip to content

Instantly share code, notes, and snippets.

@joice
Created October 15, 2013 14:35
Show Gist options
  • Save joice/6992533 to your computer and use it in GitHub Desktop.
Save joice/6992533 to your computer and use it in GitHub Desktop.
js mask
options = onKeyPress: (phone) ->
console.log phone
console.log phone.length
console.log this
masks = ["(00) 0000-0000", "(00) 00000-0000"]
mask = (if (phone.length > 14) then masks[1] else masks[0])
$(".phone-input").mask mask, this
$(".phone-input").mask "(00) 00000-0000", options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment