Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.cel').focusout(function(){ // use a classe ".cel" no campo que deseja mascarar
- 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');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement