Retirar Máscara CPF
Sou novo em javascrtipt e estou tentando tirar a máscara do campo quando entro no campo, ao sair ja consegui colcar a máscara, segue o cóidgo da função:
function RetiraMascara(ObjCPF){
cpf = ObjCPF.Value;
if (cpf.length == 14) {
cpf = cpf.charAt(0)+cpf.charAt(1)+cpf.charAt(2)+
cpf.charAt(4)+cpf.charAt(5)+cpf.charAt(6)+
cpf.charAt(8)+cpf.charAt(9)+cpf.charAt(10)+
cpf.charAt(12)+cpf.charAt(13);
alert(cpf);
return cpf;
}
};
E a chamada no html
<input name="usu_cpf" type="text" onfocus="RetiraMascara(this);" onblur="this.value = ValidarCPF(this);" onkeypress="return SomenteNumero(event);" />
Agradeço que possa me dar uma luz, coloquei um alert mas não entra no IF e tem 14 caracteres.A chamada está no OnFocusDiscussão (2)
Carregando comentários...