There is a good solution using only css here:
http://jsfiddle.net/46jrg/
just apply
text-transform: uppercase
into the text input area, and then you donβt need to worry about this complicated javascript material. Less code means less mistakes! :)
EDIT: when you select and copy the text, it will still be capitalized, but if you send it to the server, you will either have to paste it before sending, or display it when it gets there. This is usually not a big deal. Most common server languages ββcan do this with a single method call.
Java has String::toUpperCase
PHP has a strtoupper function
Python has String::upper
Ruby has String::upcase
Perl has a uc function
Javascript has String::toUpperCase
C # .NET / VB.NET has String::ToUpper
source share