HELP! Need help with a player choosing their name! (solved)

I 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].


I 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.


Thanks!!!


This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums