I have this code that makes all letters lowercase if the user is capitalized
function mayusculas(aqui){
var pepe="KarlanKas";
palabras=aqui.value.split(" ");
for(a=0;a<palabras.length;a++){
letra=palabras[a].charAt(0);
palabras[a] = letra + palabras[a].substring(1 , palabras[a].length).toLowerCase();
}
texto="";
for(a=0;a<palabras.length;a++){
if(a>0){texto+=" ";}
texto+=palabras[a];
}
aqui.value=texto;
}
The code works, if I write HELLO, the result is: Hello But if I write: hello, the result is: hello
What I want to do is that the first letter is always capital, the miniscule is already.