I'm having trouble with the javascript mask for the phone field, I'm developing mobile and I'm using the codes below.
input code:
<input type="text" name="telefone" id="telefone" maxlength="15"/>
javascript code
$('#telefone').mask('(00) 0000-00009');
$('#telefone').blur(function(event) {
if($(this).val().length == 15){ // Celular com 9 dígitos + 2 dígitos DDD e 4 da máscara
$('#telefone').mask('(00) 00000-0009');
} else {
$('#telefone').mask('(00) 0000-00009');
}
});
Console error:
Uncaught TypeError: undefined is not a function //Erro na linha do .maks(...)
What can it be? And how do you coordinate, does anyone have a better idea?
I need it to check if there is any letter and itself a mask.
Thank you in advance.