Created
July 8, 2013 20:16
-
-
Save thallisphp/5952114 to your computer and use it in GitHub Desktop.
Máscara de telefones com opção de dígito adicional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
Plugin : https://github.com/igorescobar/jQuery-Mask-Plugin/ | |
bower install jQuery-Mask-Plugin | |
components/jQuery-Mask-Plugin/jquery.mask.min.js | |
### | |
campos = jQuery '.mascara_telefone, #telefone, #celular' | |
SPphoneMask = (phone, e, currentField, options) -> | |
if phone.match /^(\(?11\)? ?9(5[0-9]|6[0-9]|7[01234569]|8[0-9]|9[0-9])[0-9]{1})/g | |
"(00) 00000-0000" | |
else | |
"(00) 0000-0000" | |
campos.attr 'placeholder', '(00)0000-0000' | |
campos.mask? SPphoneMask, | |
onKeyPress: (phone, e, currentField, options) -> | |
jQuery(currentField).mask? SPphoneMask(phone), options |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment