Hello, I have the following code that I got (It's in JavaScript) which validates the entry of only characters; and not special numbers or characters; within a input :
Code:
function SoloLetras(e)
{
key = e.keyCode || e.which;
tecla = String.fromCharCode(key);
letras = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZáéíóúabcdefghijklmnñopqrstuvwxyz";
especiales = "8-37-39-46";
tecla_especial = false;
for(var i in especiales){
if(key == especiales[i]){
tecla_especial = true;
break;
}
}
if(letras.indexOf(tecla)==-1 && !tecla_especial){
return false;
}
}
What I want to do is, in addition to everything, allow me to enter blank spaces at the time of writing. That if you could help me, I would be very grateful.
PD. The code works for me, but I want to add the aforementioned.