3
So, I’m a beginner in javascript and I was practicing doing a function that forces the scores of the CPF field
function maskCpf(){
var c_char = document.getElementById("txtCpf").value.length
if (c_char == 3){
document.getElementById("txtCpf").value = document.getElementById("txtCpf").value + "."
}else if (c_char == 7){
document.getElementById("txtCpf").value = document.getElementById("txtCpf").value + "."
}else if(c_char = 11){
document.getElementById("txtCpf").value = document.getElementById("txtCpf").value + "-"
}
}
Only this last "if" doesn’t work at all. Anyone Help?
=
versus==
– bfavaretto
This link may be useful: https://www.codecademy.com/en/forum_questions/558ea4f5e39efed371000508
– Paulo Gustavo