Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  10] [ 5]  / answers: 1 / hits: 87927  / 12 Years ago, tue, january 1, 2013, 12:00:00

How could I force the text in the username text input to be lower-case regardless of what user types?



<div class=register>
<label for=username>Select username:</label>
</div>
<div class=registerform>
<input name=username class=registerfont type=text
id=username maxlength=15 style=height:35px; width:300px>
</div>

More From » html

 Answers
34

You have to use javascript. I have an example here: http://jsfiddle.net/xCfdS/3/



HTML:
<input type=text id=txt onkeyup=return forceLower(this);/>​



Javascript:



function forceLower(strInput) 
{
strInput.value=strInput.value.toLowerCase();
}​

[#81143] Saturday, December 29, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dylondaytond

Total Points: 92
Total Questions: 88
Total Answers: 96

Location: China
Member since Fri, Jan 15, 2021
3 Years ago
dylondaytond questions
Tue, Jun 22, 21, 00:00, 3 Years ago
Thu, May 7, 20, 00:00, 4 Years ago
;