var font_name = $(".font").val();
I have this in my JavaScript code. In my html I have an input form with the class .font.
I want to capitalize the first letter of each word in .font, so for example if someone types in Lucida sans it'll turn into Lucida Sans. I couldn't find a jQuery method that does it for you so I guess I have to use actual JavaScript but I really have no idea how.
var font_first = font_name.substr(0,1);
var font = font_first.toUpperCase() + font_name.substr(1, font_name.length - 1);
I used this to capitalize the first letter of the whole font name but as I said I need to capitalize the first letter of each word.