Skip to content

Instantly share code, notes, and snippets.

@chrdesigner chrdesigner/main.js
Last active Sep 14, 2017

Embed
What would you like to do?
Máscara em jQuery para o oite e nove dígitos
// <![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
You can’t perform that action at this time.