Forum Discussion
Capitalize first letter in a text variable
Hello,
A few years ago, I created a course where I captured the learner's name using text variables and was able to capitalize the first letter of their name regardless of how they entered it. I think I used JavaScript to make this happen, but I'm not sure. Unfortunately, I can't find the .story file. I found a few options for capitalizing the first letter, but so far nothing has worked. I'm not very knowledgeable with JavaScript but would like to use this feature. If anyone has any ideas on how to make this work, I'd appreciate it. Thank you!
- Nathan_HilliardCommunity Member
Here are a few examples, pulled from https://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript/46774740#46774740.
It depends upon what type of names you expect, whether you want to adjust any letters other than the first, whether you need hyphens, etc. You can modify your preferred function.
Try it: https://360.articulate.com/review/content/61a18f59-3b8d-439a-827c-7e96d2bd854f/review