HELP! Need help with a player choosing their name! (solved)
k4denG
18 Sept 2019, 16:13I want the player to be able to choose their own name but, Most people write the name in lowercase. How do i make it where it auto capitalizes the name?
CODE:
[[start]]:
Welcome to TheHiding.
First things first, what will your Name be? (Boy please! (WILL be weird if girl name))
<div id="name-input"><input type="text" id="player-name">
[[SUBMIT]](Submit Name)
[[Submit Name]]:
squiffy.set("name", jQuery("#player-name").val());
jQuery("#name-input").remove();
You have entered "{name}".
If correct, [CONTINUE].
If incorrect, [TRY AGAIN].
mrangel
19 Sept 2019, 08:10I don't know Squiffy, but I'd guess if you're using javascript to get the value from the form, you can also use javascript to change it to title case.
squiffy.set("name", jQuery("#player-name").val().replace(/(^|\W)\w/, function(t) { return t.toUpperCase() }));
Off the top of my head; should uppercase the first character of the string, and any letter after a space.
k4denG
22 Sept 2019, 21:52Thanks!!!