A Setting Form
Many options can be changed.
This little form allows you, for example, to change the player’s name.
<form>
<input class="input-medium" type="text" id="name" name="username" placeholder="Name">
</form>
Let’s create two methods for the User object to set it right.
User.prototype.setName = function (name) {
'use strict';
if (name === undefined) { name = jQuery('#name').val(); }
if (name === '') { name = 'You'; }
this.name = name;
};
User.prototype.displayName = function () {
'use strict';
jQuery('.name', this.caption).text(this.name);
};