Capitalize first letter only

This question already has an answer here:


ANSWERS:


Not sure how you are pulling data but you can edit it via Javascript after you pulled the word.

var text = "JOHN SMITH"; //this would normally be the word you pulled
var textarray = text.toLowerCase().split(" "); // ["john", "smith"]
for (var i=0; i<textarray.length; i++) {
    textarray[i] = textarray[i].replace(textarray[i][0], textarray[i][0].toUpperCase());
}
//["John", "Smith"]

Now with textarray you can print it out however you want on the page.


There is no CSS solution for this problem, afaik.

See here, for a related posted. Please do your homework first.

The best way would be to format the data in-between your database query and your application sending it to a template.


This is impossible with CSS, because you letters are already capitalized, but you can do it with your Serverside Language (e.g. PHP), JavaScript, or even inside the Database Query


Convert the string to lowercase, using something like string modifiedString = myString.ToLower(); in your method after retreiving the string. Then use text-transform: capitalize; in your CSS.



 MORE:


 ? How Keyboard's caps lock key on for the first letter for text box?
 ? How to make a textbox not type the first letter as a capital
 ? How I make input value first-letter uppercase?
 ? how to captalize the first character of every word of a string in javascript?
 ? How to capitalize first letter of each word, like a 2-word city?
 ? how to captalize the first character of every word of a string in javascript?
 ? how to captalize the first character of every word of a string in javascript?
 ? how to captalize the first character of every word of a string in javascript?
 ? How to capitalize first letter of each word, like a 2-word city?
 ? How to downcase all char and uppercase only the first characters via js?