2
I have a Jquery mask for phone, depending on how much information the user type I understand whether it is mobile or landline.
The mask for fixed: (55)9999-9999
cell phone: (55)99999-9999
the code of the mask:
$("#Telefone").keydown(function () {
var tamanho = $("#Telefone").val().length;
if (tamanho <= 13) {
$("#Telefone").mask("(99)9999-9999");
} else if (tamanho > 13) {
$("#Telefone").mask("(99)99999-9999");
}});
The problem is that only the fixed part works, when the size variable exceeds the value 13 it no longer lets insert values in the input, even reversing the code by placing the size > 13 before, can make this comparison? or some other solution.
Obs.: I use the Jquery Mask plug-in.
Diego Braga @Virgilionovic’s reply did not answer your question?
– Wendell
The @usuario’s answer fit better what I needed, Virgilio’s also worked.
– Diego Braga
This, I consider the best response, besides this the votes she received demonstrate this.
– Wendell