I have multiple input fields that obtain a city. I would like while the user is imputing the city name that the first letter of each word to auto capitalize, while the rest of the letters are forced lower case.
NOTE: Because of my requirements, the CSS text-transform
property won't work because it only modifies the first letter of the words - - if the user types capital letters beyond the first letter, that won't adjust it.
So far i have this JavaScript:
function forceLower(strInput) {
strInput.value=strInput.value.toLowerCase();
}
Which is successfully converting the entire input to lowercase.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…