I am trying to build a JavaScript initcap function which correctly converts the first letter in each word to upper case as the other letters to lower case.
All examples I have found converts the first character which is incorrect, eg: joe smith (c e o) should convert to Joe Smith (C E O), not to Joe Smith (c E O)
CSS transform is not an option as the value is returned to a server.
Probably using regular expressions is the way to go but I am no expert at these. Any help ?