So I am a beginner in javascript and I was practicing doing a function that forces the CPF field scores
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 + "-"
}
}
It's just that this "else if" does not work at all. Someone Help?