Created
October 8, 2014 22:30
-
-
Save uhtred/701ff8897d925ecb5f79 to your computer and use it in GitHub Desktop.
JS: jQuery Mask Plugin São Paulo
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
var maskBehavior = function(val) { | |
return val.match(/^(\(?11\)? ?9(5[0-9]|6[0-9]|7[01234569]|8[0-9]|9[0-9])[0-9]{1})/g) ? '(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