Last active
September 14, 2017 21:12
-
-
Save chrdesigner/2ba891548db68bbd14c0 to your computer and use it in GitHub Desktop.
Máscara em jQuery para o oite e nove dígitos
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
// <![CDATA[ | |
jQuery(function($) { | |
$.mask.definitions['~']='[+-]'; | |
//Inicio Mascara Telefone | |
$('input[type=tel]').focusout(function(){ | |
var phone, element; | |
element = $(this); | |
element.unmask(); | |
phone = element.val().replace(/\D/g, ''); | |
if(phone.length > 10) { | |
element.mask("(99) 99999-999?9"); | |
} else { | |
element.mask("(99) 9999-9999?9"); | |
} | |
}).trigger('focusout'); | |
//Fim Mascara Telefone | |
$("#cpf").mask("999.999.999-99"); | |
$("#rg").mask("99.999.999-*"); | |
}); | |
// ]]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment