Ingresar solo letras en un input funcion en php
Fecha Publicación:
10 de Febrero de 2020
Fecha Modificación:
18 de Febrero de 2020
function soloLetras(e){
key = e.keyCode || e.which;
tecla = String.fromCharCode(key).toLowerCase();
letras = "abcdefghijklmnopqrstuvwxyz1234567890";
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){
//document.frmcontactenos.nick.value="";
return false;
}
}
Como usarla:
<input name="nick" type="text" required id="nick" size="15" maxlength="15"
onkeypress="return soloLetras(event)" onpaste="return false"/>
Articulo : 1175 - Veces Leidas