Created
August 7, 2013 11:56
-
-
Save leandrocustodio/6173440 to your computer and use it in GitHub Desktop.
Mascara de telefone com 9 digitos
This file contains hidden or 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
$("#CidadeTelefone").keyup(function(){ | |
var tel = $(this).val(); | |
phone = tel.replace(/\D/g, ''); | |
element = $(this); | |
element.unsetMask(); | |
if(phone.length > 10) { | |
element.setMask("(99) 99999-9999"); | |
} else { | |
element.setMask("(99) 9999-99999"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment