Created
December 20, 2015 21:48
-
-
Save jonasmello/240729b36a21306cad66 to your computer and use it in GitHub Desktop.
Mask mascara telefone phone fone
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
//http://cdnjs.com/libraries/jquery.meiomask | |
//https://github.com/fabiomcosta/jquery-meiomask | |
$('input#telefone').setMask({ | |
mask: '(99) 9999-99999', | |
autoTab: false | |
}).on("keyup change", function() { | |
var $this = $(this); | |
if ($this.val().length <= 14) { | |
$this.setMask({ | |
mask: '(99) 9999-99999', | |
autoTab: false | |
}); | |
} else { | |
$this.setMask({ | |
mask: '(99) 99999-9999', | |
autoTab: true | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment