Skip to content

Instantly share code, notes, and snippets.

@jonasmello
Created December 20, 2015 21:48
Show Gist options
  • Save jonasmello/240729b36a21306cad66 to your computer and use it in GitHub Desktop.
Save jonasmello/240729b36a21306cad66 to your computer and use it in GitHub Desktop.
Mask mascara telefone phone fone
//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