3
Well I’m having problems 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 to fix it, someone has some better idea ?
I need him to check if there are any lyrics and proper mask.
Thanks in advance.
You got the
plugin
charged ?– Edilson
It seems to be running before the body completes the upload. So it does not find the object
$('#telefone')
and so there’s something likeundefined.mask('(00) 0000-00009')
.. It is obvious that there will be no function/method forundefined
.. But it is only a suspicion. It may be another cause.– Daniel Omine
Daniel, this could probably be it. I’ll check when I get home
– Renan Rodrigues