2
I am trying to validate the form field using jquery, if the size is larger than Cpf number it put the cnpj mask in that same field
var tamanho = $('.cpfcnpj').length;
if (tamanho == 11){
$(".cpfcnpj").mask('000.000.000-00',{reverse: true});
alert("teste");
}
else if(tamanho > 12){
$(".cpfcnpj").mask('00.000.000/0000-00',{reverse: true});
alert("dois");
}
yes but he does not apply the mask ...
– Angel
which plugin you are using?
– Chun
http://igorescobar.github.io/jQuery-Mask-Plugin/ this one
– Angel
@Robertoaraujo on the link you submitted is there documented how you can do it. By entering this plugin link, navigate to the sections: On-the-fly Mask change and Mask as a Function in the code examples, there are two snippets of code exactly with that you want to do.
– Chun