0

Possible Duplicate:
Convert string to title case with javascript
With jQuery, how do I capitalize the first letter of a text field while the user is still editing that field?

I need the jQuery or Javascript equivalent to a PHP function:

<?php ucwords(strtolower('SOMETHING') ?> //Outputs "Something"

I've seen .toUpperCase() in Javascript, but can't find a "capitalize first letter" function.

Community
  • 1
  • 1
Plummer
  • 6,134
  • 11
  • 45
  • 74
  • 3
    did you check this post ? http://stackoverflow.com/questions/2017456/with-jquery-how-do-i-capitalize-the-first-letter-of-a-text-field-while-the-user – Oussama Jilal Dec 21 '12 at 15:28
  • Or this one? http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript – Zagor23 Dec 21 '12 at 15:29
  • the problem is, the data comes in ALL CAPS. Which is tacky and frustrating. I need to do the opposite of changing from all caps to "capitalize the first letter" in a word. I tried a CSS fix, but it didn't work. – Plummer Dec 21 '12 at 16:11
  • @Yazmat, apparently I don't know how to search for things properly. :/ – Plummer Dec 21 '12 at 16:13
  • See also [Convert JavaScript string to be all lower case?](http://stackoverflow.com/questions/154862/convert-javascript-string-to-be-all-lower-case) – Blazemonger Dec 21 '12 at 16:14

0 Answers0