txt.substr(0,1).toUpperCase()+txt.substr(1)Do you have a better solution?
Poor man's capitalization in JavaScript
I wanted to have simple capitalization in JavaScript (the first letter of the string should be upper-case, the rest of the string unchanged). Although the String object provides uppercase and lowercase functions, there is no capitalization function. The simplest expression I could come up with is this:
Related Posts by Categories
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment