-
-
Save stnc/e7432c70ff6cc6c3f8bfd51b10e31b5e to your computer and use it in GitHub Desktop.
Igor Escobar Jquery Input Mask 11 digitos telefones
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
var maskBehavior = function (val) { | |
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009'; | |
}, | |
options = {onKeyPress: function(val, e, field, options) { | |
field.mask(maskBehavior.apply({}, arguments), options); | |
} | |
}; | |
$('.phone').mask(maskBehavior, options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment