I have a text field that can not allow accents. I was using this code:
<input type="text" onkeyup="value=value.replace(/[^0-9a-zA-Z' ']/g,'')">
But rather than blocking the characters, I need them to be replaced for example by typing Ç change to C
I found a function and hes working, but when I type a dot appears the letter A
Can you help me?
<script>function retiraAcento(palavra,obj){
com_acento = 'áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ<,>´`-,*/~';
sem_acento = 'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC ';
nova='';
for(i=0;i<palavra.length;i++) {
if (com_acento.search(palavra.substr(i,1))>=0) {
nova+=sem_acento.substr(com_acento.search(palavra.substr(i,1)),1);
} else {
nova+=palavra.substr(i,1);
}
}
obj.value = nova;}</script><input type="text" onKeyUp="javascript:retiraAcento(this.value, this);">