0

Is there a way to make text inside of input text box to title case each time user pressing their keyboard using a jQuery? example:

johny english

to

Johny English

Here's the input text box

<input type="text" id="fullname" name="fullname" /> 

2 Answers 2

2

You can use pure CSS by applying text-transform property:

The text-transform CSS property specifies how to capitalize an element's text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.

#fullname { text-transform: capitalize; } 

Fiddle Demo

Sign up to request clarification or add additional context in comments.

3 Comments

Thx! Appreciate the simple solution given!
But doesn't this just make it look like the input is capitalized. When the form is submitted it send the original value. Why is this a correct answer?
Won't work if all the input is capitalized, since it will ignore all the characters except the first one of each word. (unfortunately....)
0

http://jsfiddle.net/GH3Lj/

Here you are with css text-transform : capitalize for the purpose.

1 Comment

Woah, what a simple solution. And here I'm trying to find the hard way by using jQuery. Thx!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.